Options for TrieSearch.

type TrieSearchOptions = {
    cache?: boolean;
    expandRegexes?: [{ alternate: string; regex: RegExp }];
    ignoreCase?: boolean;
    insertFullUnsplitKey?: boolean;
    maxCacheSize?: number;
    min?: number;
    splitOnGetRegEx?: RegExp | false;
    splitOnRegEx?: RegExp | false;
    tokenizer?: (str: string) => IterableIterator<string>;
}
Index

Properties

cache?: boolean

Is caching enabled; default: true.

expandRegexes?: [{ alternate: string; regex: RegExp }]

By default, this is set to an array of international vowels expansions, allowing searches for vowels like 'a' to return matches on 'å' or 'ä' etc. Set this to an empty array / [] if you want to disable it. See the top of src/trie/TrieSearch.js file for examples.

ignoreCase?: boolean

Ignores case in lookups; default: true.

insertFullUnsplitKey?: boolean

In TrieSearch.map when splitOnRegEx is defined and insertFullUnsplitKey is true the full key will also be mapped; default: false.

maxCacheSize?: number

The max cache size before removing entries in a LRU manner; default: 64.

min?: number

The size of the prefix for keys; minimum length of a key to store and search. By default, this is 1, but you might improve performance by using 2 or 3.

splitOnGetRegEx?: RegExp | false

How phrases are split on retrieval / get; default: /\s/g.

splitOnRegEx?: RegExp | false

How phrases are split on search; default: /\s/g. By default, this is any whitespace. Set to false if you have whitespace in your keys! Set it to something else to split along other boundaries.

tokenizer?: (str: string) => IterableIterator<string>

Provide a custom tokenizer that is used to split keys. IE a Grapheme / Unicode tokenizer.