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
A
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"));
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final CompletionAnalyzer
Used to analyze the term text -
Constructor Summary
ConstructorDescriptionPrefixCompletionQuery
(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
Modifier and TypeMethodDescriptioncreateWeight
(IndexSearcher searcher, ScoreMode scoreMode, float boost) boolean
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 Details
-
analyzer
Used to analyze the term text
-
-
Constructor Details
-
PrefixCompletionQuery
CallsPrefixCompletionQuery(Analyzer, Term, BitsProducer)
with no filter -
PrefixCompletionQuery
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 Details
-
createWeight
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException - Overrides:
createWeight
in classQuery
- Throws:
IOException
-
visit
-
getAnalyzer
Gets the analyzer used to analyze the prefix. -
equals
-
hashCode
public int hashCode()
-