public class PrefixCompletionQuery extends CompletionQuery
CompletionQuery which takes an Analyzer
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"));
| Modifier and Type | Field and Description |
|---|---|
protected CompletionAnalyzer |
analyzer
Used to analyze the term text
|
| Constructor and Description |
|---|
PrefixCompletionQuery(Analyzer analyzer,
Term term)
Calls
PrefixCompletionQuery(Analyzer, Term, BitsProducer)
with no filter |
PrefixCompletionQuery(Analyzer analyzer,
Term term,
BitsProducer filter)
Constructs an analyzed prefix completion query
|
| Modifier and Type | Method and Description |
|---|---|
Weight |
createWeight(IndexSearcher searcher,
boolean needsScores,
float boost)
Expert: Constructs an appropriate Weight implementation for this query.
|
boolean |
equals(java.lang.Object o)
Override and implement query instance equivalence properly in a subclass.
|
Analyzer |
getAnalyzer()
Gets the analyzer used to analyze the prefix.
|
int |
hashCode()
Override and implement query hash code properly in a subclass.
|
getField, getFilter, getTerm, rewrite, toStringclassHash, sameClassAs, toStringprotected final CompletionAnalyzer analyzer
public PrefixCompletionQuery(Analyzer analyzer, Term term)
PrefixCompletionQuery(Analyzer, Term, BitsProducer)
with no filterpublic PrefixCompletionQuery(Analyzer analyzer, Term term, BitsProducer filter)
analyzer - used to analyze the provided Term.text()term - query is run against Term.field() and Term.text()
is analyzed with analyzerfilter - used to query on a sub set of documentspublic Weight createWeight(IndexSearcher searcher, boolean needsScores, float boost) throws java.io.IOException
QueryOnly implemented by primitive queries, which re-write to themselves.
createWeight in class QueryneedsScores - True if document scores (Scorer.score()) are needed.boost - The boost that is propagated by the parent queries.java.io.IOExceptionpublic Analyzer getAnalyzer()
public boolean equals(java.lang.Object o)
QueryQueryCache works properly.
Typically a query will be equal to another only if it's an instance of
the same class and its document-filtering properties are identical that other
instance. Utility methods are provided for certain repetitive code.equals in class QueryQuery.sameClassAs(Object),
Query.classHash()public int hashCode()
QueryQueryCache works properly.hashCode in class QueryQuery.equals(Object)Copyright © 2000–2025 The Apache Software Foundation. All rights reserved.