public class PhraseQuery extends Query
BooleanQuery
.Constructor and Description |
---|
PhraseQuery()
Constructs an empty phrase query.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Term term) |
void |
add(Term term,
Integer position,
boolean considerAsATerm)
Adds a term to the end of the query phrase.
|
protected Weight |
createWeight(Searcher searcher)
Expert: Constructs an appropriate Weight implementation for this query.
|
boolean |
equals(Object o)
Returns true iff
o is equal to this. |
int |
getSlop()
Returns the slop.
|
Term[] |
getTerms()
Returns the set of terms in this phrase.
|
int |
hashCode()
Returns a hash code value for this object.
|
void |
setSlop(int s)
Sets the number of other words permitted between words in query phrase.
|
void |
setTotalTerms(int totalTerms) |
String |
toString(String f)
Prints a user-readable version of this query.
|
clone, combine, getBoost, getSimilarity, mergeBooleanQueries, rewrite, setBoost, toString, weight
public void setSlop(int s)
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.
public int getSlop()
public void add(Term term, Integer position, boolean considerAsATerm)
public void setTotalTerms(int totalTerms)
public void add(Term term)
public Term[] getTerms()
protected Weight createWeight(Searcher searcher)
Query
Only implemented by primitive queries, which re-write to themselves.
createWeight
in class Query
public boolean equals(Object o)
o
is equal to this.Copyright © 2024 GATE. All rights reserved.