Class SlowFuzzyQuery
Implements the classic fuzzy search query. The similarity measurement is based on the Levenshtein (edit distance) algorithm.
Note that, unlike Lucene.Net.Search.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).Inherited Members
Namespace: Lucene.Net.Sandbox.Queries
Assembly: Lucene.Net.Sandbox.dll
Syntax
[Obsolete("Use FuzzyQuery instead.")]
public class SlowFuzzyQuery : MultiTermQuery
Constructors
SlowFuzzyQuery(Term)
Declaration
public SlowFuzzyQuery(Term term)
Parameters
Type | Name | Description |
---|---|---|
Term | term |
SlowFuzzyQuery(Term, float)
Declaration
public SlowFuzzyQuery(Term term, float minimumSimilarity)
Parameters
Type | Name | Description |
---|---|---|
Term | term | |
float | minimumSimilarity |
SlowFuzzyQuery(Term, float, int)
Declaration
public SlowFuzzyQuery(Term term, float minimumSimilarity, int prefixLength)
Parameters
Type | Name | Description |
---|---|---|
Term | term | |
float | minimumSimilarity | |
int | prefixLength |
SlowFuzzyQuery(Term, float, int, int)
Create a new SlowFuzzyQuery that will match terms with a similarity
of at least minimumSimilarity
to term
.
If a prefixLength
> 0 is specified, a common prefix
of that length is also required.
Declaration
public SlowFuzzyQuery(Term term, float minimumSimilarity, int prefixLength, int maxExpansions)
Parameters
Type | Name | Description |
---|---|---|
Term | term | the term to search for |
float | minimumSimilarity | a value between 0 and 1 to set the required similarity
between the query term and the matching terms. For example, for a
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.
|
int | prefixLength | length of common (non-fuzzy) prefix |
int | maxExpansions | the maximum number of terms to match. If this number is greater than Lucene.Net.Search.BooleanQuery.MaxClauseCount when the query is rewritten, then the maxClauseCount will be used instead. |
Exceptions
Type | Condition |
---|---|
ArgumentException | if |
Fields
defaultMaxExpansions
Implements the classic fuzzy search query. The similarity measurement is based on the Levenshtein (edit distance) algorithm.
Note that, unlike Lucene.Net.Search.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).Declaration
public const int defaultMaxExpansions = 50
Field Value
Type | Description |
---|---|
int |
defaultMinSimilarity
Implements the classic fuzzy search query. The similarity measurement is based on the Levenshtein (edit distance) algorithm.
Note that, unlike Lucene.Net.Search.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).Declaration
public const float defaultMinSimilarity = 2
Field Value
Type | Description |
---|---|
float |
defaultPrefixLength
Implements the classic fuzzy search query. The similarity measurement is based on the Levenshtein (edit distance) algorithm.
Note that, unlike Lucene.Net.Search.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).Declaration
public const int defaultPrefixLength = 0
Field Value
Type | Description |
---|---|
int |
m_term
Implements the classic fuzzy search query. The similarity measurement is based on the Levenshtein (edit distance) algorithm.
Note that, unlike Lucene.Net.Search.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).Declaration
protected Term m_term
Field Value
Type | Description |
---|---|
Term |
Properties
MinSimilarity
Gets the minimum similarity that is required for this query to match. Returns float value between 0.0 and 1.0.
Declaration
public virtual float MinSimilarity { get; }
Property Value
Type | Description |
---|---|
float |
PrefixLength
Gets the non-fuzzy prefix length. This is the number of characters at the start of a term that must be identical (not fuzzy) to the query term if the query is to match that term.
Declaration
public virtual int PrefixLength { get; }
Property Value
Type | Description |
---|---|
int |
Term
Gets the pattern term.
Declaration
public virtual Term Term { get; }
Property Value
Type | Description |
---|---|
Term |
Methods
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
GetTermsEnum(Terms, AttributeSource)
Construct the enumeration to be used, expanding the pattern term. this method should only be called if the field exists (ie, implementations can assume the field does exist). this method should not return null (should instead return Lucene.Net.Index.TermsEnum.EMPTY if no terms match). The Lucene.Net.Index.TermsEnum must already be positioned to the first matching term. The given Lucene.Net.Util.AttributeSource is passed by the Lucene.Net.Search.MultiTermQuery.RewriteMethod to provide attributes, the rewrite method uses to inform about e.g. maximum competitive boosts. this is currently only used by Lucene.Net.Search.TopTermsRewrite<Q>.
Declaration
protected override TermsEnum GetTermsEnum(Terms terms, AttributeSource atts)
Parameters
Type | Name | Description |
---|---|---|
Terms | terms | |
AttributeSource | atts |
Returns
Type | Description |
---|---|
TermsEnum |
Overrides
ToString(string)
Prints a query to a string, with field
assumed to be the
default field and omitted.
Declaration
public override string ToString(string field)
Parameters
Type | Name | Description |
---|---|---|
string | field |
Returns
Type | Description |
---|---|
string |