Class PrefixCompletionQuery
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.lucene.search.suggest.document.CompletionQuery
-
- org.apache.lucene.search.suggest.document.PrefixCompletionQuery
-
- Direct Known Subclasses:
FuzzyCompletionQuery
public class PrefixCompletionQuery extends CompletionQuery
ACompletionQuery
which takes anAnalyzer
to analyze the prefix of the query term.Example usage of querying an analyzed prefix 'sugg' against a field 'suggest_field' is as follows:
CompletionQuery query = new PrefixCompletionQuery(analyzer, new Term("suggest_field", "sugg"));
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description protected CompletionAnalyzer
analyzer
Used to analyze the term text
-
Constructor Summary
Constructors Constructor Description PrefixCompletionQuery(Analyzer analyzer, Term term)
CallsPrefixCompletionQuery(Analyzer, Term, BitsProducer)
with no filterPrefixCompletionQuery(Analyzer analyzer, Term term, BitsProducer filter)
Constructs an analyzed prefix completion query
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Weight
createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)
boolean
equals(Object o)
Analyzer
getAnalyzer()
Gets the analyzer used to analyze the prefix.int
hashCode()
void
visit(QueryVisitor visitor)
-
Methods inherited from class org.apache.lucene.search.suggest.document.CompletionQuery
getField, getFilter, getTerm, rewrite, toString
-
Methods inherited from class org.apache.lucene.search.Query
classHash, sameClassAs, toString
-
-
-
-
Field Detail
-
analyzer
protected final CompletionAnalyzer analyzer
Used to analyze the term text
-
-
Constructor Detail
-
PrefixCompletionQuery
public PrefixCompletionQuery(Analyzer analyzer, Term term)
CallsPrefixCompletionQuery(Analyzer, Term, BitsProducer)
with no filter
-
PrefixCompletionQuery
public PrefixCompletionQuery(Analyzer analyzer, Term term, BitsProducer filter)
Constructs an analyzed prefix completion query- Parameters:
analyzer
- used to analyze the providedTerm.text()
term
- query is run againstTerm.field()
andTerm.text()
is analyzed withanalyzer
filter
- used to query on a sub set of documents
-
-
Method Detail
-
createWeight
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException
- Overrides:
createWeight
in classQuery
- Throws:
IOException
-
visit
public void visit(QueryVisitor visitor)
-
getAnalyzer
public Analyzer getAnalyzer()
Gets the analyzer used to analyze the prefix.
-
-