Show / Hide Table of Contents

    Class FSTCompletionLookup

    An adapter from Lookup API to FSTCompletion.

    This adapter differs from FSTCompletion in that it attempts to discretize any "weights" as passed from in Weight to match the number of buckets. For the rationale for bucketing, see FSTCompletion.

    Note:Discretization requires an additional sorting pass.

    The range of weights for bucketing/ discretization is determined by sorting the input by weight and then dividing into equal ranges. Then, scores within each range are assigned to that bucket.

    Note that this means that even large differences in weights may be lost during automaton construction, but the overall distinction between "classes" of weights will be preserved regardless of the distribution of weights.

    For fine-grained control over which weights are assigned to which buckets, use FSTCompletion directly or TSTLookup, for example.

    Inheritance
    System.Object
    Lookup
    FSTCompletionLookup
    Inherited Members
    Lookup.CHARSEQUENCE_COMPARER
    Lookup.Build(IDictionary)
    Lookup.Load(Stream)
    Lookup.Store(Stream)
    Lookup.DoLookup(String, Boolean, Int32)
    Namespace: Lucene.Net.Search.Suggest.Fst
    Assembly: Lucene.Net.Suggest.dll
    Syntax
    public class FSTCompletionLookup : Lookup

    Constructors

    | Improve this Doc View Source

    FSTCompletionLookup()

    This constructor prepares for creating a suggested FST using the Build(IInputIterator) method. The number of weight discretization buckets is set to DEFAULT_BUCKETS and exact matches are promoted to the top of the suggestions list.

    Declaration
    public FSTCompletionLookup()
    | Improve this Doc View Source

    FSTCompletionLookup(FSTCompletion, Boolean)

    This constructor takes a pre-built automaton.

    Declaration
    public FSTCompletionLookup(FSTCompletion completion, bool exactMatchFirst)
    Parameters
    Type Name Description
    FSTCompletion completion

    An instance of FSTCompletion.

    System.Boolean exactMatchFirst

    If

    true
    exact matches are promoted to the top of the suggestions list. Otherwise they appear in the order of discretized weight and alphabetical within the bucket.

    | Improve this Doc View Source

    FSTCompletionLookup(Int32, Boolean)

    This constructor prepares for creating a suggested FST using the Build(IInputIterator) method.

    Declaration
    public FSTCompletionLookup(int buckets, bool exactMatchFirst)
    Parameters
    Type Name Description
    System.Int32 buckets

    The number of weight discretization buckets (see FSTCompletion for details).

    System.Boolean exactMatchFirst

    If true exact matches are promoted to the top of the suggestions list. Otherwise they appear in the order of discretized weight and alphabetical within the bucket.

    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

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

    Declaration
    public override IList<Lookup.LookupResult> DoLookup(string key, IEnumerable<BytesRef> contexts, bool higherWeightsFirst, int num)
    Parameters
    Type Name Description
    System.String key
    IEnumerable<BytesRef> contexts
    System.Boolean higherWeightsFirst
    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 bucket (weight) as a Long for the provided key if it exists, otherwise null if it does not.

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

    GetSizeInBytes()

    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)

    See Also

    FSTCompletion
    • Improve this Doc
    • View Source
    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)