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
ACompletionQuerywhich takes anAnalyzerto 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 CompletionAnalyzeranalyzerUsed 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 WeightcreateWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost)booleanequals(Object o)AnalyzergetAnalyzer()Gets 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, toString
-
Methods inherited from class org.apache.lucene.search.Query
classHash, rewrite, 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 withanalyzerfilter- used to query on a sub set of documents
-
-
Method Detail
-
createWeight
public Weight createWeight(IndexSearcher searcher, ScoreMode scoreMode, float boost) throws IOException
- Overrides:
createWeightin classQuery- Throws:
IOException
-
visit
public void visit(QueryVisitor visitor)
-
getAnalyzer
public Analyzer getAnalyzer()
Gets the analyzer used to analyze the prefix.
-
-