|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.search.Query
org.apache.lucene.search.PhraseQuery
public class PhraseQuery
A Query that matches documents containing a particular sequence of terms.
This may be combined with other terms with a BooleanQuery
.
Constructor Summary | |
---|---|
PhraseQuery()
Constructs an empty phrase query. |
Method Summary | |
---|---|
void |
add(Term term)
Adds a term to the end of the query phrase. |
void |
add(Term term,
int position)
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(java.lang.Object o)
Returns true iff o is equal to this. |
int[] |
getPositions()
Returns the relative positions of terms in this phrase. |
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. |
java.lang.String |
toString(java.lang.String f)
Prints a user-readable version of this query. |
Methods inherited from class org.apache.lucene.search.Query |
---|
clone, combine, getBoost, getSimilarity, mergeBooleanQueries, rewrite, setBoost, toString, weight |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PhraseQuery()
Method Detail |
---|
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)
public void add(Term term, int position)
term
- position
- public Term[] getTerms()
public int[] getPositions()
protected Weight createWeight(Searcher searcher)
Query
Only implemented by primitive queries, which re-write to themselves.
createWeight
in class Query
public java.lang.String toString(java.lang.String f)
toString
in class Query
public boolean equals(java.lang.Object o)
o
is equal to this.
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |