|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.search.Query org.apache.lucene.search.MultiTermQuery org.apache.lucene.sandbox.queries.SlowFuzzyQuery
FuzzyQuery
instead.
@Deprecated public class SlowFuzzyQuery
Implements the classic fuzzy search query. The similarity measurement is based on the Levenshtein (edit distance) algorithm.
Note that, unlike FuzzyQuery
, this query will silently allow
for a (possibly huge) number of edit distances in comparisons, and may
be extremely slow (comparing every term in the index).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.lucene.search.MultiTermQuery |
---|
MultiTermQuery.ConstantScoreAutoRewrite, MultiTermQuery.RewriteMethod, MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite, MultiTermQuery.TopTermsScoringBooleanQueryRewrite |
Field Summary | |
---|---|
static int |
defaultMaxExpansions
Deprecated. |
static float |
defaultMinSimilarity
Deprecated. |
static int |
defaultPrefixLength
Deprecated. |
protected Term |
term
Deprecated. |
Fields inherited from class org.apache.lucene.search.MultiTermQuery |
---|
CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, CONSTANT_SCORE_FILTER_REWRITE, field, rewriteMethod, SCORING_BOOLEAN_QUERY_REWRITE |
Constructor Summary | |
---|---|
SlowFuzzyQuery(Term term)
Deprecated. Calls SlowFuzzyQuery(term, defaultMinSimilarity, 0, defaultMaxExpansions) . |
|
SlowFuzzyQuery(Term term,
float minimumSimilarity)
Deprecated. Calls SlowFuzzyQuery(term, minimumSimilarity, 0, defaultMaxExpansions) . |
|
SlowFuzzyQuery(Term term,
float minimumSimilarity,
int prefixLength)
Deprecated. Calls SlowFuzzyQuery(term, minimumSimilarity, prefixLength, defaultMaxExpansions) . |
|
SlowFuzzyQuery(Term term,
float minimumSimilarity,
int prefixLength,
int maxExpansions)
Deprecated. Create a new SlowFuzzyQuery that will match terms with a similarity of at least minimumSimilarity to term . |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Deprecated. |
float |
getMinSimilarity()
Deprecated. Returns the minimum similarity that is required for this query to match. |
int |
getPrefixLength()
Deprecated. Returns the non-fuzzy prefix length. |
Term |
getTerm()
Deprecated. Returns the pattern term. |
protected TermsEnum |
getTermsEnum(Terms terms,
AttributeSource atts)
Deprecated. |
int |
hashCode()
Deprecated. |
String |
toString(String field)
Deprecated. |
Methods inherited from class org.apache.lucene.search.MultiTermQuery |
---|
getField, getRewriteMethod, getTermsEnum, rewrite, setRewriteMethod |
Methods inherited from class org.apache.lucene.search.Query |
---|
clone, createWeight, extractTerms, getBoost, setBoost, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final float defaultMinSimilarity
public static final int defaultPrefixLength
public static final int defaultMaxExpansions
protected Term term
Constructor Detail |
---|
public SlowFuzzyQuery(Term term, float minimumSimilarity, int prefixLength, int maxExpansions)
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.5
Alternatively, if minimumSimilarity
is >= 1f, it is interpreted
as a pure Levenshtein edit distance. For example, a value of 2f
will match all terms within an edit distance of 2
from the
query term. Edit distances specified in this way may not be fractional.
prefixLength
- length of common (non-fuzzy) prefixmaxExpansions
- the maximum number of terms to match. If this number is
greater than BooleanQuery.getMaxClauseCount()
when the query is rewritten,
then the maxClauseCount will be used instead.
IllegalArgumentException
- if minimumSimilarity is >= 1 or < 0
or if prefixLength < 0public SlowFuzzyQuery(Term term, float minimumSimilarity, int prefixLength)
SlowFuzzyQuery(term, minimumSimilarity, prefixLength, defaultMaxExpansions)
.
public SlowFuzzyQuery(Term term, float minimumSimilarity)
SlowFuzzyQuery(term, minimumSimilarity, 0, defaultMaxExpansions)
.
public SlowFuzzyQuery(Term term)
SlowFuzzyQuery(term, defaultMinSimilarity, 0, defaultMaxExpansions)
.
Method Detail |
---|
public float getMinSimilarity()
public int getPrefixLength()
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException
getTermsEnum
in class MultiTermQuery
IOException
public Term getTerm()
public String toString(String field)
toString
in class Query
public int hashCode()
hashCode
in class MultiTermQuery
public boolean equals(Object obj)
equals
in class MultiTermQuery
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |