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.
Inherited Members
Namespace: Lucene.Net.Search.Suggest.Fst
Assembly: Lucene.Net.Suggest.dll
Syntax
public class FSTCompletionLookup : Lookup
Constructors
| Improve this Doc View SourceFSTCompletionLookup()
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()
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 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.
|
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 |
Properties
| Improve this Doc View SourceCount
Declaration
public override long Count { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Overrides
Methods
| Improve this Doc View SourceBuild(IInputIterator)
Declaration
public override void Build(IInputIterator iterator)
Parameters
Type | Name | Description |
---|---|---|
IInputIterator | iterator |
Overrides
| Improve this Doc View SourceDoLookup(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 | |
System.Collections.Generic.IEnumerable<BytesRef> | contexts | |
System.Boolean | higherWeightsFirst | |
System.Int32 | num |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<Lookup.LookupResult> |
Overrides
| Improve this Doc View SourceGet(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 |
GetSizeInBytes()
Declaration
public override long GetSizeInBytes()
Returns
Type | Description |
---|---|
System.Int64 |
Overrides
| Improve this Doc View SourceLoad(DataInput)
Declaration
public override bool Load(DataInput input)
Parameters
Type | Name | Description |
---|---|---|
DataInput | input |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceStore(DataOutput)
Declaration
public override bool Store(DataOutput output)
Parameters
Type | Name | Description |
---|---|---|
DataOutput | output |
Returns
Type | Description |
---|---|
System.Boolean |