Lucene\'s manual has explained the meaning of proximity search for a phrase with two words clearly, such as the \"jakarta apache\"~10
example in
http://l
The slop (proximity) works like an edit distance (see PhraseQuery.setSlop). So, the terms could be reordered or have extra terms added. This means that the proximity would be the maximum number of terms added into the whole query. That is:
"jakarta apache lucene"~3
Will match:
But not:
Some people have been confused by:
"lucene jakarta apache" (distance: 4)
The simple explanation is that swapping terms takes two edits, so:
The longer, but more accurate, explanation is that every edit allows a term to be moved by one position. The first move of a swap transposes two terms on top of each other. Keeping this in mind explains why any set of three terms can be rearranged into any order with distance no greater than 4.