
SpellIndex
- Namespace
- Rowles.LeanCorpus.Search.Suggestions
- Assembly
- Rowles.LeanCorpus.dll
Pre-built character-trigram inverted index for fast spelling correction. Build once via Build(IndexSearcher, string), then call Suggest(string, int, int) per query. This mirrors the external benchmark baseline's SpellChecker pattern: amortise the dictionary scan at build time, achieve near-constant-time lookups at query time.
public sealed class SpellIndex
- Inheritance
-
SpellIndex
TermCount
The number of unique terms in this index.
Build(IndexSearcher, string)
Builds a SpellIndex for the given field by extracting all unique terms from the segment readers and constructing a trigram inverted index. This is an O(T * L) operation where T is the unique term count and L is average term length. Call once and reuse for multiple Suggest(string, int, int) calls.
Suggest(string, int, int)
Suggests corrections for the given query term. The overlap counts array is rented from ArrayPool<T> so repeated calls allocate only the small result list.