Class WFSTCompletionLookup
Suggester based on a weighted FST: it first traverses the prefix, then walks the n shortest paths to retrieve top-ranked suggestions.
NOTE: Input weights must be between 0 and MaxValue, any other values will be rejected.
Note
This API is experimental and might change in incompatible ways in the next release.
Inherited Members
Namespace: Lucene.Net.Search.Suggest.Fst
Assembly: Lucene.Net.Suggest.dll
Syntax
public class WFSTCompletionLookup : Lookup
Constructors
WFSTCompletionLookup()
Declaration
public WFSTCompletionLookup()
WFSTCompletionLookup(bool)
Creates a new suggester.
Declaration
public WFSTCompletionLookup(bool exactFirst)
Parameters
Type | Name | Description |
---|---|---|
bool | exactFirst | if suggestions that match the
|
Properties
Count
Get the number of entries the lookup was built with
Declaration
public override long Count { get; }
Property Value
Type | Description |
---|---|
long | total number of suggester entries |
Overrides
Methods
Build(IInputEnumerator)
Builds up a new internal Lookup representation based on the given IInputEnumerator. The implementation might re-sort the data internally.
Declaration
public override void Build(IInputEnumerator enumerator)
Parameters
Type | Name | Description |
---|---|---|
IInputEnumerator | enumerator |
Overrides
DoLookup(string, IEnumerable<BytesRef>, bool, int)
Look up a key and return possible completion for this key.
Declaration
public override IList<Lookup.LookupResult> DoLookup(string key, IEnumerable<BytesRef> contexts, bool onlyMorePopular, int num)
Parameters
Type | Name | Description |
---|---|---|
string | key | lookup key. Depending on the implementation this may be a prefix, misspelling, or even infix. |
IEnumerable<BytesRef> | contexts | contexts to filter the lookup by, or null if all contexts are allowed; if the suggestion contains any of the contexts, it's a match |
bool | onlyMorePopular | return only more popular results |
int | num | maximum number of results to return |
Returns
Type | Description |
---|---|
IList<Lookup.LookupResult> | a list of possible completions, with their relative weight (e.g. popularity) |
Overrides
Get(string)
Returns the weight associated with an input string, or null if it does not exist.
Declaration
public virtual long? Get(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key |
Returns
Type | Description |
---|---|
long? |
GetSizeInBytes()
Returns byte size of the underlying FST.
Declaration
public override long GetSizeInBytes()
Returns
Type | Description |
---|---|
long |
Overrides
Load(DataInput)
Discard current lookup data and load it from a previously saved copy. Optional operation.
Declaration
public override bool Load(DataInput input)
Parameters
Type | Name | Description |
---|---|---|
DataInput | input | the Lucene.Net.Store.DataInput to load the lookup data. |
Returns
Type | Description |
---|---|
bool | true if completed successfully, false if unsuccessful or not supported. |
Overrides
Exceptions
Type | Condition |
---|---|
IOException | when fatal IO error occurs. |
Store(DataOutput)
Persist the constructed lookup data to a directory. Optional operation.
Declaration
public override bool Store(DataOutput output)
Parameters
Type | Name | Description |
---|---|---|
DataOutput | output | Lucene.Net.Store.DataOutput to write the data to. |
Returns
Type | Description |
---|---|
bool | true if successful, false if unsuccessful or not supported. |
Overrides
Exceptions
Type | Condition |
---|---|
IOException | when fatal IO error occurs. |