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://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Proximity Searches
However, I am wondering what does a search like "jakarta apache lucene"~10
exactly do? Does it allow neighboring words to be at most 10 words apart, or all pairs of words to be that?
Thanks!
Lucene supports single and multiple character wildcard searches within single terms (not within phrase queries). To perform a single character wildcard search use the "?" symbol. To perform a multiple character wildcard search use the "*" symbol. You can also use the wildcard searches in the middle of a term.
You can't search for special characters in Lucene Search. These are + - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ / @.
Step 1 − Create object of IndexSearcher. Step 2 − Create a Lucene directory which should point to location where indexes are to be stored. Step 3 − Initialize the IndexSearcher object created with the index directory.
What is Lucene Query Syntax? Lucene is a query language that can be used to filter messages in your PhishER inbox. A query written in Lucene can be broken down into three parts: Field The ID or name of a specific container of information in a database.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With