You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Antony Bowesman <ad...@teamware.com> on 2006/11/20 04:54:11 UTC
How to do a "starts with" search
Hi,
I'm trying to replace an existing search mechanism that supports a 'starts with'
type of searching, for example a mail subject can contain the string
A B C D
the existing search allows the user to search starts with 'A B*' which would
match, whereas starts with 'B C*' would not. PhraseQuery with no slop would
would not work as it would match.
Is there any query I can enfore the starts with, so that 'B C*' does not match.
If not, do I have to use some HitsCollector to filter the results after the
search - but then how do I find out the positional information.
Regards
Antony
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: How to do a "starts with" search
Posted by Antony Bowesman <ad...@teamware.com>.
Martin Braun wrote:
> Please refer to the answers to my question on this list:
> http://www.nabble.com/forum/ViewPost.jtp?post=7337585&framed=y
>
> Shortly spoken: SpanFirstQuery works like a charm :)
Thanks Martin, that looks just right. I'll try it.
Antony
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: How to do a "starts with" search
Posted by Martin Braun <mb...@uni-hd.de>.
Hi Antony Bowesman schrieb:
> Hi,
>
> I'm trying to replace an existing search mechanism that supports a
> 'starts with' type of searching, for example a mail subject can contain
> the string
>
> A B C D
>
> the existing search allows the user to search starts with 'A B*' which
> would match, whereas starts with 'B C*' would not. PhraseQuery with no
> slop would would not work as it would match.
>
> Is there any query I can enfore the starts with, so that 'B C*' does not
> match.
Please refer to the answers to my question on this list:
http://www.nabble.com/forum/ViewPost.jtp?post=7337585&framed=y
Shortly spoken: SpanFirstQuery works like a charm :)
hth,
martin
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org