lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saurabh Gokhale <>
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.



On Mon, Aug 22, 2011 at 5:18 PM, <> 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

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