| 
 | ||||||||||
| 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. | 
|  Weight | createWeight(Searcher searcher)Expert: Constructs an appropriate Weight implementation for this query. | 
|  boolean | equals(Object o)Returns true if ois equal to this. | 
|  void | extractTerms(Set terms)Expert: adds all terms occurring 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)
Queryrewritten form.
extractTerms in class Querypublic Query rewrite(IndexReader reader)
Query
rewrite in class Query
public Weight createWeight(Searcher searcher)
                    throws IOException
QueryOnly implemented by primitive queries, which re-write to themselves.
createWeight in class QueryIOExceptionpublic final String toString(String f)
toString in class Querypublic boolean equals(Object o)
o is equal to this.
equals in class Querypublic int hashCode()
hashCode in class Query| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||