FuzzyQuery
instead.@Deprecated public class SlowFuzzyQuery extends MultiTermQuery
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).
MultiTermQuery.RewriteMethod, MultiTermQuery.TopTermsBlendedFreqScoringRewrite, MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite, MultiTermQuery.TopTermsScoringBooleanQueryRewrite
Modifier and Type | Field and Description |
---|---|
static int |
defaultMaxExpansions
Deprecated.
|
static float |
defaultMinSimilarity
Deprecated.
|
static int |
defaultPrefixLength
Deprecated.
|
protected Term |
term
Deprecated.
|
CONSTANT_SCORE_BOOLEAN_REWRITE, CONSTANT_SCORE_REWRITE, field, rewriteMethod, SCORING_BOOLEAN_REWRITE
Constructor and Description |
---|
SlowFuzzyQuery(Term term)
Deprecated.
|
SlowFuzzyQuery(Term term,
float minimumSimilarity)
Deprecated.
|
SlowFuzzyQuery(Term term,
float minimumSimilarity,
int prefixLength)
Deprecated.
|
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 . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Deprecated.
Override and implement query instance equivalence properly in a subclass.
|
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.
Construct the enumeration to be used, expanding the
pattern term.
|
int |
hashCode()
Deprecated.
Override and implement query hash code properly in a subclass.
|
String |
toString(String field)
Deprecated.
Prints a query to a string, with
field assumed to be the
default field and omitted. |
getField, getRewriteMethod, getTermsEnum, rewrite, setRewriteMethod
classHash, createWeight, sameClassAs, toString
public static final float defaultMinSimilarity
public static final int defaultPrefixLength
public static final int defaultMaxExpansions
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)
public SlowFuzzyQuery(Term term, float minimumSimilarity)
public SlowFuzzyQuery(Term term)
public float getMinSimilarity()
public int getPrefixLength()
protected TermsEnum getTermsEnum(Terms terms, AttributeSource atts) throws IOException
MultiTermQuery
TermsEnum.EMPTY
if no
terms match). The TermsEnum must already be
positioned to the first matching term.
The given AttributeSource
is passed by the MultiTermQuery.RewriteMethod
to
provide attributes, the rewrite method uses to inform about e.g. maximum competitive boosts.
This is currently only used by TopTermsRewrite
getTermsEnum
in class MultiTermQuery
IOException
public String toString(String field)
Query
field
assumed to be the
default field and omitted.public int hashCode()
Query
QueryCache
works properly.hashCode
in class MultiTermQuery
Query.equals(Object)
public boolean equals(Object obj)
Query
QueryCache
works properly.
Typically a query will be equal to another only if it's an instance of
the same class and its document-filtering properties are identical that other
instance. Utility methods are provided for certain repetitive code.equals
in class MultiTermQuery
Query.sameClassAs(Object)
,
Query.classHash()