Class Lookup
Simple Lookup interface for System.String suggestions.
Inheritance
Inherited Members
Namespace: Lucene.Net.Search.Suggest
Assembly: Lucene.Net.Suggest.dll
Syntax
public abstract class Lookup
Constructors
| Improve this Doc View SourceLookup()
Sole constructor. (For invocation by subclass constructors, typically implicit.)
Declaration
public Lookup()
Fields
| Improve this Doc View SourceCHARSEQUENCE_COMPARER
A simple char-by-char comparer for System.String
Declaration
public static readonly IComparer<string> CHARSEQUENCE_COMPARER
Field Value
Type | Description |
---|---|
System.Collections.Generic.IComparer<System.String> |
Properties
| Improve this Doc View SourceCount
Get the number of entries the lookup was built with
Declaration
public abstract long Count { get; }
Property Value
Type | Description |
---|---|
System.Int64 | total number of suggester entries |
Methods
| Improve this Doc View SourceBuild(IDictionary)
Build lookup from a dictionary. Some implementations may require sorted or unsorted keys from the dictionary's iterator - use SortedInputIterator or UnsortedInputIterator in such case.
Declaration
public virtual void Build(IDictionary dict)
Parameters
Type | Name | Description |
---|---|---|
IDictionary | dict |
Build(IInputIterator)
Builds up a new internal Lookup representation based on the given IInputIterator. The implementation might re-sort the data internally.
Declaration
public abstract void Build(IInputIterator inputIterator)
Parameters
Type | Name | Description |
---|---|---|
IInputIterator | inputIterator |
DoLookup(String, Boolean, Int32)
Look up a key and return possible completion for this key.
Declaration
public virtual IList<Lookup.LookupResult> DoLookup(string key, bool onlyMorePopular, int num)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | lookup key. Depending on the implementation this may be a prefix, misspelling, or even infix. |
System.Boolean | onlyMorePopular | return only more popular results |
System.Int32 | num | maximum number of results to return |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<Lookup.LookupResult> | a list of possible completions, with their relative weight (e.g. popularity) |
DoLookup(String, IEnumerable<BytesRef>, Boolean, Int32)
Look up a key and return possible completion for this key.
Declaration
public abstract IList<Lookup.LookupResult> DoLookup(string key, IEnumerable<BytesRef> contexts, bool onlyMorePopular, int num)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | lookup key. Depending on the implementation this may be a prefix, misspelling, or even infix. |
System.Collections.Generic.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 |
System.Boolean | onlyMorePopular | return only more popular results |
System.Int32 | num | maximum number of results to return |
Returns
Type | Description |
---|---|
System.Collections.Generic.IList<Lookup.LookupResult> | a list of possible completions, with their relative weight (e.g. popularity) |
GetSizeInBytes()
Get the size of the underlying lookup implementation in memory
Declaration
public abstract long GetSizeInBytes()
Returns
Type | Description |
---|---|
System.Int64 | ram size of the lookup implementation in bytes |
Load(DataInput)
Discard current lookup data and load it from a previously saved copy. Optional operation.
Declaration
public abstract bool Load(DataInput input)
Parameters
Type | Name | Description |
---|---|---|
DataInput | input | the DataInput to load the lookup data. |
Returns
Type | Description |
---|---|
System.Boolean | true if completed successfully, false if unsuccessful or not supported. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | when fatal IO error occurs. |
Load(Stream)
Calls Load(DataInput) after converting System.IO.Stream to DataInput
Declaration
public virtual bool Load(Stream input)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | input |
Returns
Type | Description |
---|---|
System.Boolean |
Store(DataOutput)
Persist the constructed lookup data to a directory. Optional operation.
Declaration
public abstract bool Store(DataOutput output)
Parameters
Type | Name | Description |
---|---|---|
DataOutput | output | DataOutput to write the data to. |
Returns
Type | Description |
---|---|
System.Boolean | true if successful, false if unsuccessful or not supported. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | when fatal IO error occurs. |
Store(Stream)
Calls Store(DataOutput) after converting System.IO.Stream to DataOutput
Declaration
public virtual bool Store(Stream output)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | output |
Returns
Type | Description |
---|---|
System.Boolean |