Is there a way to use a proximity operator (like near or within) with Lucene?

Otis Gospodnetic

There is a variable called slop in PhraseQuery that allows you to perform NEAR/WITHIN-like queries.
By default, slop is set to 0 so that only exact phrases will match. However, you can alter the value using the setSlop(int) method.
For instance, setSlop(3) will let you find documents containing a phrase such as "monkeys love bananas".

There is currently no way to specify the slop in the query, although there has been some discussion about it on the Lucene mailing list recently.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact