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).
Inheritance
System.Object
SlowFuzzyQuery
Inherited Members
Lucene.Net.Search.Query.ExtractTerms(ISet<>)
Assembly: Lucene.Net.Sandbox.dll
Syntax
public class SlowFuzzyQuery : MultiTermQuery
Constructors
|
Improve this Doc
View Source
SlowFuzzyQuery(Term)
Declaration
public SlowFuzzyQuery(Term term)
Parameters
Type |
Name |
Description |
Term |
term |
|
|
Improve this Doc
View Source
SlowFuzzyQuery(Term, Single)
Declaration
public SlowFuzzyQuery(Term term, float minimumSimilarity)
Parameters
Type |
Name |
Description |
Term |
term |
|
System.Single |
minimumSimilarity |
|
|
Improve this Doc
View Source
SlowFuzzyQuery(Term, Single, Int32)
Declaration
public SlowFuzzyQuery(Term term, float minimumSimilarity, int prefixLength)
Parameters
Type |
Name |
Description |
Term |
term |
|
System.Single |
minimumSimilarity |
|
System.Int32 |
prefixLength |
|
|
Improve this Doc
View Source
SlowFuzzyQuery(Term, Single, Int32, Int32)
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
|
System.Single |
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 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.
|
System.Int32 |
prefixLength |
length of common (non-fuzzy) prefix
|
System.Int32 |
maxExpansions |
the maximum number of terms to match. If this number is
greater than MaxClauseCount when the query is rewritten,
then the maxClauseCount will be used instead.
|
Fields
|
Improve this Doc
View Source
defaultMaxExpansions
Declaration
public static readonly int defaultMaxExpansions
Field Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
defaultMinSimilarity
Declaration
public static readonly float defaultMinSimilarity
Field Value
Type |
Description |
System.Single |
|
|
Improve this Doc
View Source
defaultPrefixLength
Declaration
public static readonly int defaultPrefixLength
Field Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
m_term
Declaration
Field Value
Properties
|
Improve this Doc
View Source
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 |
System.Single |
|
|
Improve this Doc
View Source
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 |
System.Int32 |
|
|
Improve this Doc
View Source
Term
Declaration
public virtual Term Term { get; }
Property Value
Methods
|
Improve this Doc
View Source
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
|
Improve this Doc
View Source
GetTermsEnum(Terms, AttributeSource)
Declaration
protected override TermsEnum GetTermsEnum(Terms terms, AttributeSource atts)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
ToString(String)
Declaration
public override string ToString(string field)
Parameters
Type |
Name |
Description |
System.String |
field |
|
Returns
Type |
Description |
System.String |
|