java.lang.Object | ||
↳ | org.apache.lucene.search.Query | |
↳ | org.apache.lucene.search.PhraseQuery |
A Query that matches documents containing a particular sequence of terms.
A PhraseQuery is built by QueryParser for input like "new york"
.
This query may be combined with other terms or queries with a BooleanQuery
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs an empty phrase query.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds a term to the end of the query phrase.
| |||||||||||
Adds a term to the end of the query phrase.
| |||||||||||
Expert: Constructs an appropriate Weight implementation for this query.
| |||||||||||
Returns true iff
o is equal to this. | |||||||||||
Expert: adds all terms occurring in this query to the terms set.
| |||||||||||
Returns the relative positions of terms in this phrase.
| |||||||||||
Returns the slop.
| |||||||||||
Returns the set of terms in this phrase.
| |||||||||||
Returns a hash code value for this object.
| |||||||||||
Sets the number of other words permitted between words in query phrase.
| |||||||||||
Prints a user-readable version of this query.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.search.Query
| |||||||||||
From class
java.lang.Object
|
Constructs an empty phrase query.
Adds a term to the end of the query phrase. The relative position of the term is the one immediately after the last term added.
Adds a term to the end of the query phrase. The relative position of the term within the phrase is specified explicitly. This allows e.g. phrases with more than one term at the same position or phrases with gaps (e.g. in connection with stopwords).
Expert: Constructs an appropriate Weight implementation for this query.
Only implemented by primitive queries, which re-write to themselves.
IOException |
---|
Expert: adds all terms occurring in this query to the terms set. Only
works if this query is in its rewritten
form.
Returns the relative positions of terms in this phrase.
Returns the slop. See setSlop().
Returns a hash code value for this object.
Sets the number of other words permitted between words in query phrase.
If zero, then this is an exact phrase search. For larger values this works
like a WITHIN
or NEAR
operator.
The slop is in fact an edit-distance, where the units correspond to moves of terms in the query phrase out of position. For example, to switch the order of two words requires two moves (the first move places the words atop one another), so to permit re-orderings of phrases, the slop must be at least two.
More exact matches are scored higher than sloppier matches, thus search results are sorted by exactness.
The slop is zero by default, requiring exact matches.