public class MultiPhraseQuery extends Query
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 and Description |
---|
MultiPhraseQuery() |
Modifier and Type | Method and Description |
---|---|
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(IndexSearcher 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<Term> 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<Term[]> |
getTermArrays()
Returns a List of the terms in the multiphrase.
|
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.
|
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)
PhraseQuery.add(Term, int)
public List<Term[]> getTermArrays()
public int[] getPositions()
public void extractTerms(Set<Term> terms)
Query
rewritten
form.extractTerms
in class Query
public Query rewrite(IndexReader reader)
Query
public Weight createWeight(IndexSearcher searcher) throws IOException
Query
Only implemented by primitive queries, which re-write to themselves.
createWeight
in class Query
IOException
public boolean equals(Object o)
o
is equal to this.Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.