public class FuzzyQuery extends MultiTermQuery
| Modifier and Type | Class and Description |
|---|---|
protected static class |
FuzzyQuery.ScoreTerm |
protected static class |
FuzzyQuery.ScoreTermQueue |
MultiTermQuery.ConstantScoreAutoRewrite, MultiTermQuery.RewriteMethod| Modifier and Type | Field and Description |
|---|---|
static float |
defaultMinSimilarity |
static int |
defaultPrefixLength |
protected Term |
term |
CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, CONSTANT_SCORE_FILTER_REWRITE, rewriteMethod, SCORING_BOOLEAN_QUERY_REWRITE| Constructor and Description |
|---|
FuzzyQuery(Term term)
Calls
FuzzyQuery(term, 0.5f, 0). |
FuzzyQuery(Term term,
float minimumSimilarity)
|
FuzzyQuery(Term term,
float minimumSimilarity,
int prefixLength)
Create a new FuzzyQuery that will match terms with a similarity
of at least
minimumSimilarity to term. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
protected FilteredTermEnum |
getEnum(IndexReader reader)
Construct the enumeration to be used, expanding the pattern term.
|
float |
getMinSimilarity()
Returns the minimum similarity that is required for this query to match.
|
int |
getPrefixLength()
Returns the non-fuzzy prefix length.
|
Term |
getTerm()
Returns the pattern term.
|
int |
hashCode() |
Query |
rewrite(IndexReader reader)
Expert: called to re-write queries into primitive queries.
|
void |
setRewriteMethod(MultiTermQuery.RewriteMethod method)
Sets the rewrite method to be used when executing the
query.
|
java.lang.String |
toString(java.lang.String field)
Prints a query to a string, with
field assumed to be the
default field and omitted. |
clearTotalNumberOfTerms, getRewriteMethod, getTotalNumberOfTerms, incTotalNumberOfTermsclone, combine, createWeight, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weightpublic static final float defaultMinSimilarity
public static final int defaultPrefixLength
protected Term term
public FuzzyQuery(Term term, float minimumSimilarity, int prefixLength) throws java.lang.IllegalArgumentException
minimumSimilarity to term.
If a prefixLength > 0 is specified, a common prefix
of that length is also required.term - the term to search forminimumSimilarity - a value between 0 and 1 to set the required similarity
between the query term and the matching terms. For example, for a
minimumSimilarity of 0.5 a term of the same length
as the query term is considered similar to the query term if the edit distance
between both terms is less than length(term)*0.5prefixLength - length of common (non-fuzzy) prefixjava.lang.IllegalArgumentException - if minimumSimilarity is >= 1 or < 0
or if prefixLength < 0public FuzzyQuery(Term term, float minimumSimilarity) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic FuzzyQuery(Term term)
FuzzyQuery(term, 0.5f, 0).public float getMinSimilarity()
public int getPrefixLength()
protected FilteredTermEnum getEnum(IndexReader reader) throws java.io.IOException
MultiTermQuerygetEnum in class MultiTermQueryjava.io.IOExceptionpublic Term getTerm()
getTerm in class MultiTermQuerypublic void setRewriteMethod(MultiTermQuery.RewriteMethod method)
MultiTermQueryMultiTermQuery.RewriteMethod.setRewriteMethod in class MultiTermQuerypublic Query rewrite(IndexReader reader) throws java.io.IOException
Queryrewrite in class MultiTermQueryjava.io.IOExceptionpublic java.lang.String toString(java.lang.String field)
Queryfield assumed to be the
default field and omitted.
The representation used is one that is supposed to be readable
by QueryParser. However,
there are the following limitations:
toString in class MultiTermQuerypublic int hashCode()
hashCode in class MultiTermQuerypublic boolean equals(java.lang.Object obj)
equals in class MultiTermQueryCopyright © 2000-2016 Apache Software Foundation. All Rights Reserved.