lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saurabh Gokhale <saurabhgokh...@gmail.com>
Subject Re: SpanNearQuery vs. PhraseQuery.setSlop
Date Thu, 25 Aug 2011 16:10:30 GMT
Yes, this can be achieved using SpanNearQuery with inOrder flag (third
argument to the constructor) set to false.

there is a good example (Listing 5.10) in Lucene in action if you want to
take a look.

Thanks

Saurabh

On Mon, Aug 22, 2011 at 5:18 PM, <ikoelliker@daegis.com> wrote:

> Hello,
> We are using phrase queries with a slop value to perform Near and Within
> style searches and the issue we are encountering is as follows:
>
> Since the slop value in the PhraseQuery is the edit-distance, a message
> with the terms  'thank' and 'you' will be found with a query of field:"thank
> you"~1 but will not be found with a query of field:"you thank"~1. Currently
> to work around this nuance I am creating a new query of field:("you thank"~1
> OR "thank you"~1).
>
> Can I solve this by constructing a SpanNearQuery with two
> SpanTermQuery("thank") and SpanTermQuery("you") and a slop value of 1 and
> the ordering of false?
>
> Thanks,
> Ian Koelliker
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message