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
FieldsModifier and TypeFieldDescriptionprotected final CompletionAnalyzerUsed to analyze the term text -
Constructor Summary
ConstructorsConstructorDescriptionPrefixCompletionQuery(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) booleanGets the analyzer used to analyze the prefix.inthashCode()voidvisit(QueryVisitor visitor) Methods inherited from class org.apache.lucene.search.suggest.document.CompletionQuery
getField, getFilter, getTerm, rewrite, toStringMethods 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 withanalyzerfilter- used to query on a sub set of documents
-
-
Method Details
-
createWeight
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException - Overrides:
createWeightin classQuery- Throws:
IOException
-
visit
-
getAnalyzer
Gets the analyzer used to analyze the prefix. -
equals
-
hashCode
public int hashCode()
-