Show / Hide Table of Contents

    Class FuzzySuggester

    Implements a fuzzy AnalyzingSuggester. The similarity measurement is based on the Damerau-Levenshtein (optimal string alignment) algorithm, though you can explicitly choose classic Levenshtein by passing false for the Lucene.Net.Search.Suggest.Analyzing.FuzzySuggester.transpositions parameter.

    At most, this query will match terms up to edits. Higher distances are not supported. Note that the fuzzy distance is measured in "byte space" on the bytes returned by the 's , usually UTF8. By default the analyzed bytes must be at least 3 DEFAULT_MIN_FUZZY_LENGTH bytes before any edits are considered. Furthermore, the first 1 DEFAULT_NON_FUZZY_PREFIX byte is not allowed to be edited. We allow up to 1 DEFAULT_MAX_EDITS edit. If Lucene.Net.Search.Suggest.Analyzing.FuzzySuggester.unicodeAware parameter in the constructor is set to true, maxEdits, minFuzzyLength, transpositions and nonFuzzyPrefix are measured in Unicode code points (actual letters) instead of bytes.

    NOTE: This suggester does not boost suggestions that required no edits over suggestions that did require edits. This is a known limitation.

    Note: complex query analyzers can have a significant impact on the lookup performance. It's recommended to not use analyzers that drop or inject terms like synonyms to keep the complexity of the prefix intersection low for good lookup performance. At index time, complex analyzers can safely be used.

    This is a Lucene.NET EXPERIMENTAL API, use at your own risk
    Inheritance
    System.Object
    Lookup
    AnalyzingSuggester
    FuzzySuggester
    Inherited Members
    AnalyzingSuggester.GetSizeInBytes()
    AnalyzingSuggester.Build(IInputIterator)
    AnalyzingSuggester.Store(DataOutput)
    AnalyzingSuggester.Load(DataInput)
    AnalyzingSuggester.DoLookup(String, IEnumerable<BytesRef>, Boolean, Int32)
    AnalyzingSuggester.Count
    AnalyzingSuggester.Get(String)
    Lookup.CHARSEQUENCE_COMPARER
    Lookup.Build(IDictionary)
    Lookup.Load(Stream)
    Lookup.Store(Stream)
    Lookup.DoLookup(String, Boolean, Int32)
    Namespace: Lucene.Net.Search.Suggest.Analyzing
    Assembly: Lucene.Net.Suggest.dll
    Syntax
    public sealed class FuzzySuggester : AnalyzingSuggester

    Constructors

    | Improve this Doc View Source

    FuzzySuggester(Analyzer)

    Creates a FuzzySuggester instance initialized with default values.

    Declaration
    public FuzzySuggester(Analyzer analyzer)
    Parameters
    Type Name Description
    Analyzer analyzer

    The used for this suggester.

    | Improve this Doc View Source

    FuzzySuggester(Analyzer, Analyzer)

    Creates a FuzzySuggester instance with an index & a query analyzer initialized with default values.

    Declaration
    public FuzzySuggester(Analyzer indexAnalyzer, Analyzer queryAnalyzer)
    Parameters
    Type Name Description
    Analyzer indexAnalyzer

    that will be used for analyzing suggestions while building the index.

    Analyzer queryAnalyzer

    that will be used for analyzing query text during lookup

    | Improve this Doc View Source

    FuzzySuggester(Analyzer, Analyzer, SuggesterOptions, Int32, Int32, Boolean, Int32, Boolean, Int32, Int32, Boolean)

    Creates a FuzzySuggester instance.

    Declaration
    public FuzzySuggester(Analyzer indexAnalyzer, Analyzer queryAnalyzer, SuggesterOptions options, int maxSurfaceFormsPerAnalyzedForm, int maxGraphExpansions, bool preservePositionIncrements, int maxEdits, bool transpositions, int nonFuzzyPrefix, int minFuzzyLength, bool unicodeAware)
    Parameters
    Type Name Description
    Analyzer indexAnalyzer

    The that will be used for analyzing suggestions while building the index.

    Analyzer queryAnalyzer

    The that will be used for analyzing query text during lookup

    SuggesterOptions options

    see EXACT_FIRST, PRESERVE_SEP

    System.Int32 maxSurfaceFormsPerAnalyzedForm

    Maximum number of surface forms to keep for a single analyzed form. When there are too many surface forms we discard the lowest weighted ones.

    System.Int32 maxGraphExpansions

    Maximum number of graph paths to expand from the analyzed form. Set this to -1 for no limit.

    System.Boolean preservePositionIncrements

    Whether position holes should appear in the automaton

    System.Int32 maxEdits

    must be >= 0 and <= .

    System.Boolean transpositions

    true if transpositions should be treated as a primitive edit operation. If this is false, comparisons will implement the classic Levenshtein algorithm.

    System.Int32 nonFuzzyPrefix

    length of common (non-fuzzy) prefix (see default DEFAULT_NON_FUZZY_PREFIX

    System.Int32 minFuzzyLength

    minimum length of lookup key before any edits are allowed (see default DEFAULT_MIN_FUZZY_LENGTH)

    System.Boolean unicodeAware

    operate Unicode code points instead of bytes.

    Fields

    | Improve this Doc View Source

    DEFAULT_MAX_EDITS

    The default maximum number of edits for fuzzy suggestions.

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

    DEFAULT_MIN_FUZZY_LENGTH

    The default minimum length of the key passed to Lookup before any edits are allowed.

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

    DEFAULT_NON_FUZZY_PREFIX

    The default prefix length where edits are not allowed.

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

    DEFAULT_TRANSPOSITIONS

    The default transposition value passed to

    Declaration
    public const bool DEFAULT_TRANSPOSITIONS = null
    Field Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    DEFAULT_UNICODE_AWARE

    Measure Lucene.Net.Search.Suggest.Analyzing.FuzzySuggester.maxEdits, Lucene.Net.Search.Suggest.Analyzing.FuzzySuggester.minFuzzyLength, Lucene.Net.Search.Suggest.Analyzing.FuzzySuggester.transpositions, and Lucene.Net.Search.Suggest.Analyzing.FuzzySuggester.nonFuzzyPrefix parameters in Unicode code points (actual letters) instead of bytes.

    Declaration
    public const bool DEFAULT_UNICODE_AWARE = null
    Field Value
    Type Description
    System.Boolean

    Methods

    | Improve this Doc View Source

    ConvertAutomaton(Automaton)

    Declaration
    protected override Automaton ConvertAutomaton(Automaton a)
    Parameters
    Type Name Description
    Automaton a
    Returns
    Type Description
    Automaton
    Overrides
    AnalyzingSuggester.ConvertAutomaton(Automaton)
    | Improve this Doc View Source

    GetFullPrefixPaths(IList<FSTUtil.Path<PairOutputs<Nullable<Int64>, BytesRef>.Pair>>, Automaton, FST<PairOutputs<Nullable<Int64>, BytesRef>.Pair>)

    Declaration
    protected override IList<FSTUtil.Path<PairOutputs<long?, BytesRef>.Pair>> GetFullPrefixPaths(IList<FSTUtil.Path<PairOutputs<long?, BytesRef>.Pair>> prefixPaths, Automaton lookupAutomaton, FST<PairOutputs<long?, BytesRef>.Pair> fst)
    Parameters
    Type Name Description
    IList<FSTUtil.Path<PairOutputs.Pair<>>> prefixPaths
    Automaton lookupAutomaton
    FST<PairOutputs.Pair<>> fst
    Returns
    Type Description
    IList<FSTUtil.Path<PairOutputs.Pair<>>>
    Overrides
    AnalyzingSuggester.GetFullPrefixPaths(IList<FSTUtil.Path<PairOutputs<Nullable<Int64>, BytesRef>.Pair>>, Automaton, FST<PairOutputs<Nullable<Int64>, BytesRef>.Pair>)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)