Fork me on GitHub
  • API

    Show / Hide Table of Contents

    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).

    Inheritance
    System.Object
    Lucene.Net.Search.Query
    Lucene.Net.Search.MultiTermQuery
    SlowFuzzyQuery
    Inherited Members
    Lucene.Net.Search.MultiTermQuery.m_field
    Lucene.Net.Search.MultiTermQuery.m_rewriteMethod
    Lucene.Net.Search.MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE
    Lucene.Net.Search.MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE
    Lucene.Net.Search.MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE
    Lucene.Net.Search.MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT
    Lucene.Net.Search.MultiTermQuery.Field
    Lucene.Net.Search.MultiTermQuery.GetTermsEnum(Lucene.Net.Index.Terms)
    Lucene.Net.Search.MultiTermQuery.Rewrite(Lucene.Net.Index.IndexReader)
    Lucene.Net.Search.MultiTermQuery.MultiTermRewriteMethod
    Lucene.Net.Search.Query.Boost
    Lucene.Net.Search.Query.ToString()
    Lucene.Net.Search.Query.CreateWeight(Lucene.Net.Search.IndexSearcher)
    Query.ExtractTerms(ISet<Term>)
    Lucene.Net.Search.Query.Clone()
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Lucene.Net.Sandbox.Queries
    Assembly: Lucene.Net.Sandbox.dll
    Syntax
    [Obsolete("Use FuzzyQuery instead.")]
    public class SlowFuzzyQuery : MultiTermQuery

    Constructors

    | Improve this Doc View Source

    SlowFuzzyQuery(Term)

    Calls SlowFuzzyQuery(Term, Single).

    Declaration
    public SlowFuzzyQuery(Term term)
    Parameters
    Type Name Description
    Lucene.Net.Index.Term term
    | Improve this Doc View Source

    SlowFuzzyQuery(Term, Single)

    Calls SlowFuzzyQuery(Term, Single).

    Declaration
    public SlowFuzzyQuery(Term term, float minimumSimilarity)
    Parameters
    Type Name Description
    Lucene.Net.Index.Term term
    System.Single minimumSimilarity
    | Improve this Doc View Source

    SlowFuzzyQuery(Term, Single, Int32)

    Calls SlowFuzzyQuery(Term, Single).

    Declaration
    public SlowFuzzyQuery(Term term, float minimumSimilarity, int prefixLength)
    Parameters
    Type Name Description
    Lucene.Net.Index.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
    Lucene.Net.Index.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.

    Exceptions
    Type Condition
    System.ArgumentException

    if minimumSimilarity is >= 1 or < 0 or if prefixLength < 0

    Fields

    | Improve this Doc View Source

    defaultMaxExpansions

    Declaration
    public const int defaultMaxExpansions = 50
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    defaultMinSimilarity

    Declaration
    public const float defaultMinSimilarity = 2F
    Field Value
    Type Description
    System.Single
    | Improve this Doc View Source

    defaultPrefixLength

    Declaration
    public const int defaultPrefixLength = 0
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    m_term

    Declaration
    protected Term m_term
    Field Value
    Type Description
    Lucene.Net.Index.Term

    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

    Gets the pattern term.

    Declaration
    public virtual Term Term { get; }
    Property Value
    Type Description
    Lucene.Net.Index.Term

    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
    Overrides
    MultiTermQuery.Equals(Object)
    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    Lucene.Net.Search.MultiTermQuery.GetHashCode()
    | Improve this Doc View Source

    GetTermsEnum(Terms, AttributeSource)

    Declaration
    protected override TermsEnum GetTermsEnum(Terms terms, AttributeSource atts)
    Parameters
    Type Name Description
    Lucene.Net.Index.Terms terms
    Lucene.Net.Util.AttributeSource atts
    Returns
    Type Description
    Lucene.Net.Index.TermsEnum
    Overrides
    Lucene.Net.Search.MultiTermQuery.GetTermsEnum(Lucene.Net.Index.Terms, Lucene.Net.Util.AttributeSource)
    | 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
    Overrides
    Query.ToString(String)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2021 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.