|
||||||||||
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.MultiPhraseQuery
public class MultiPhraseQuery
MultiPhraseQuery is a generalized version of PhraseQuery, with an added
method add(Term[])
.
To use this class, to search for the phrase "Microsoft app*" first use
add(Term) on the term "Microsoft", then find all terms that have "app" as
prefix using IndexReader.terms(Term), and use MultiPhraseQuery.add(Term[]
terms) to add them to the query.
Constructor Summary | |
---|---|
MultiPhraseQuery()
|
Method Summary | |
---|---|
void |
add(Term term)
Add a single term at the next position in the phrase. |
void |
add(Term[] terms)
Add multiple terms at the next position in the phrase. |
void |
add(Term[] terms,
int position)
Allows to specify the relative position of terms within the phrase. |
protected Weight |
createWeight(Searcher searcher)
Expert: Constructs an appropriate Weight implementation for this query. |
boolean |
equals(Object o)
Returns true if o is equal to this. |
void |
extractTerms(Set terms)
Expert: adds all terms occuring in this query to the terms set. |
int[] |
getPositions()
Returns the relative positions of terms in this phrase. |
int |
getSlop()
Sets the phrase slop for this query. |
List |
getTermArrays()
Returns a List |
int |
hashCode()
Returns a hash code value for this object. |
Query |
rewrite(IndexReader reader)
Expert: called to re-write queries into primitive queries. |
void |
setSlop(int s)
Sets the phrase slop for this query. |
String |
toString(String f)
Prints a user-readable version of this query. |
Methods inherited from class org.apache.lucene.search.Query |
---|
clone, combine, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MultiPhraseQuery()
Method Detail |
---|
public void setSlop(int s)
PhraseQuery.setSlop(int)
public int getSlop()
PhraseQuery.getSlop()
public void add(Term term)
PhraseQuery.add(Term)
public void add(Term[] terms)
PhraseQuery.add(Term)
public void add(Term[] terms, int position)
terms
- position
- PhraseQuery.add(Term, int)
public List getTermArrays()
public int[] getPositions()
public void extractTerms(Set terms)
Query
rewritten
form.
extractTerms
in class Query
public Query rewrite(IndexReader reader)
Query
rewrite
in class Query
protected Weight createWeight(Searcher searcher) throws IOException
Query
Only implemented by primitive queries, which re-write to themselves.
createWeight
in class Query
IOException
public final String toString(String f)
toString
in class Query
public boolean equals(Object o)
o
is equal to this.
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |