Package org.apache.lucene.search
Class PrefixQuery
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.lucene.search.MultiTermQuery
-
- org.apache.lucene.search.PrefixQuery
-
- All Implemented Interfaces:
Serializable,Cloneable
public class PrefixQuery extends MultiTermQuery
A Query that matches documents containing terms with a specified prefix. A PrefixQuery is built by QueryParser for input likeapp*.This query uses the
MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULTrewrite method.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.search.MultiTermQuery
MultiTermQuery.ConstantScoreAutoRewrite, MultiTermQuery.RewriteMethod, MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite, MultiTermQuery.TopTermsScoringBooleanQueryRewrite
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.search.MultiTermQuery
CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, CONSTANT_SCORE_FILTER_REWRITE, rewriteMethod, SCORING_BOOLEAN_QUERY_REWRITE
-
-
Constructor Summary
Constructors Constructor Description PrefixQuery(Term prefix)Constructs a query for terms starting withprefix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)protected FilteredTermEnumgetEnum(IndexReader reader)Construct the enumeration to be used, expanding the pattern term.TermgetPrefix()Returns the prefix of this query.inthashCode()StringtoString(String field)Prints a user-readable version of this query.-
Methods inherited from class org.apache.lucene.search.MultiTermQuery
clearTotalNumberOfTerms, getRewriteMethod, getTotalNumberOfTerms, incTotalNumberOfTerms, rewrite, setRewriteMethod
-
Methods inherited from class org.apache.lucene.search.Query
clone, combine, createWeight, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight
-
-
-
-
Constructor Detail
-
PrefixQuery
public PrefixQuery(Term prefix)
Constructs a query for terms starting withprefix.
-
-
Method Detail
-
getPrefix
public Term getPrefix()
Returns the prefix of this query.
-
getEnum
protected FilteredTermEnum getEnum(IndexReader reader) throws IOException
Description copied from class:MultiTermQueryConstruct the enumeration to be used, expanding the pattern term.- Specified by:
getEnumin classMultiTermQuery- Throws:
IOException
-
hashCode
public int hashCode()
- Overrides:
hashCodein classMultiTermQuery
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classMultiTermQuery
-
-