Show / Hide Table of Contents

    Class AnalyzingSuggester

    Suggester that first analyzes the surface form, adds the analyzed form to a weighted FST, and then does the same thing at lookup time. This means lookup is based on the analyzed form while suggestions are still the surface form(s).

    This can result in powerful suggester functionality. For example, if you use an analyzer removing stop words, then the partial text "ghost chr..." could see the suggestion "The Ghost of Christmas Past". Note that position increments MUST NOT be preserved for this example to work, so you should call the constructor with Lucene.Net.Search.Suggest.Analyzing.AnalyzingSuggester.preservePositionIncrements parameter set to false

    If SynonymFilter is used to map wifi and wireless network to hotspot then the partial text "wirele..." could suggest "wifi router". Token normalization like stemmers, accent removal, etc., would allow suggestions to ignore such variations.

    When two matching suggestions have the same weight, they are tie-broken by the analyzed form. If their analyzed form is the same then the order is undefined.

    There are some limitations:

    1. A lookup from a query like "net" in English won't be any different than "net " (ie, user added a trailing space) because analyzers don't reflect when they've seen a token separator and when they haven't.
    2. If you're using StopFilter, and the user will type "fast apple", but so far all they've typed is "fast a", again because the analyzer doesn't convey whether it's seen a token separator after the "a", StopFilter will remove that "a" causing far more matches than you'd expect.
    3. Lookups with the empty string return no results instead of all results.
    @lucene.experimental

    Inheritance
    System.Object
    Lookup
    AnalyzingSuggester
    FuzzySuggester
    Inherited Members
    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 class AnalyzingSuggester : Lookup

    Constructors

    | Improve this Doc View Source

    AnalyzingSuggester(Analyzer)

    Calls AnalyzingSuggester(Analyzer, Analyzer, SuggesterOptions, Int32, Int32, Boolean)

    Declaration
    public AnalyzingSuggester(Analyzer analyzer)
    Parameters
    Type Name Description
    Analyzer analyzer
    | Improve this Doc View Source

    AnalyzingSuggester(Analyzer, Analyzer)

    Calls AnalyzingSuggester(Analyzer, Analyzer, SuggesterOptions, Int32, Int32, Boolean)

    Declaration
    public AnalyzingSuggester(Analyzer indexAnalyzer, Analyzer queryAnalyzer)
    Parameters
    Type Name Description
    Analyzer indexAnalyzer
    Analyzer queryAnalyzer
    | Improve this Doc View Source

    AnalyzingSuggester(Analyzer, Analyzer, SuggesterOptions, Int32, Int32, Boolean)

    Creates a new suggester.

    Declaration
    public AnalyzingSuggester(Analyzer indexAnalyzer, Analyzer queryAnalyzer, SuggesterOptions options, int maxSurfaceFormsPerAnalyzedForm, int maxGraphExpansions, bool preservePositionIncrements)
    Parameters
    Type Name Description
    Analyzer indexAnalyzer

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

    Analyzer queryAnalyzer

    Analyzer 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 automata

    Properties

    | Improve this Doc View Source

    Count

    Declaration
    public override long Count { get; }
    Property Value
    Type Description
    System.Int64
    Overrides
    Lookup.Count

    Methods

    | Improve this Doc View Source

    Build(IInputIterator)

    Declaration
    public override void Build(IInputIterator iterator)
    Parameters
    Type Name Description
    IInputIterator iterator
    Overrides
    Lookup.Build(IInputIterator)
    | Improve this Doc View Source

    ConvertAutomaton(Automaton)

    Used by subclass to change the lookup automaton, if necessary.

    Declaration
    protected virtual Automaton ConvertAutomaton(Automaton a)
    Parameters
    Type Name Description
    Automaton a
    Returns
    Type Description
    Automaton
    | Improve this Doc View Source

    DoLookup(String, IEnumerable<BytesRef>, Boolean, Int32)

    Declaration
    public override IList<Lookup.LookupResult> DoLookup(string key, IEnumerable<BytesRef> contexts, bool onlyMorePopular, int num)
    Parameters
    Type Name Description
    System.String key
    IEnumerable<BytesRef> contexts
    System.Boolean onlyMorePopular
    System.Int32 num
    Returns
    Type Description
    IList<Lookup.LookupResult>
    Overrides
    Lookup.DoLookup(String, IEnumerable<BytesRef>, Boolean, Int32)
    | Improve this Doc View Source

    Get(String)

    Returns the weight associated with an input string, or null if it does not exist.

    Declaration
    public virtual object Get(string key)
    Parameters
    Type Name Description
    System.String key
    Returns
    Type Description
    System.Object
    | Improve this Doc View Source

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

    Returns all prefix paths to initialize the search.

    Declaration
    protected virtual 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<>>>
    | Improve this Doc View Source

    GetSizeInBytes()

    Returns byte size of the underlying FST.

    Declaration
    public override long GetSizeInBytes()
    Returns
    Type Description
    System.Int64
    Overrides
    Lookup.GetSizeInBytes()
    | Improve this Doc View Source

    Load(DataInput)

    Declaration
    public override bool Load(DataInput input)
    Parameters
    Type Name Description
    DataInput input
    Returns
    Type Description
    System.Boolean
    Overrides
    Lookup.Load(DataInput)
    | Improve this Doc View Source

    Store(DataOutput)

    Declaration
    public override bool Store(DataOutput output)
    Parameters
    Type Name Description
    DataOutput output
    Returns
    Type Description
    System.Boolean
    Overrides
    Lookup.Store(DataOutput)
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)