org.apache.lucene.search
Class MultiPhraseQuery
- Cloneable, Serializable
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.
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)
|
boolean | equals(Object o) - Returns true if
o is equal to this.
|
int[] | getPositions() - Returns the relative positions of terms in this phrase.
|
int | getSlop() - Sets the phrase slop for this query.
|
int | hashCode() - Returns a hash code value for this object.
|
Query | rewrite(IndexReader reader)
|
void | setSlop(int s) - Sets the phrase slop for this query.
|
String | toString(String f) - Prints a user-readable version of this query.
|
clone , combine , createWeight , extractTerms , getBoost , getSimilarity , mergeBooleanQueries , rewrite , setBoost , toString , toString , weight |
add
public void add(Term term)
Add a single term at the next position in the phrase.
add
public void add(Term[] terms)
Add multiple terms at the next position in the phrase. Any of the terms
may match.
add
public void add(Term[] terms,
int position)
Allows to specify the relative position of terms within the phrase.
equals
public boolean equals(Object o)
Returns true if o
is equal to this.
getPositions
public int[] getPositions()
Returns the relative positions of terms in this phrase.
getSlop
public int getSlop()
Sets the phrase slop for this query.
hashCode
public int hashCode()
Returns a hash code value for this object.
setSlop
public void setSlop(int s)
Sets the phrase slop for this query.
toString
public final String toString(String f)
Prints a user-readable version of this query.
- toString in interface Query
Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.