@yoch/frozenminisearch v1.12.1
    Preparing search index...

    Type Alias SearchOptions

    Search options to customize the search behavior.

    type SearchOptions = {
        bm25?: BM25Params;
        boost?: { [fieldName: string]: number };
        boostDocument?: (
            documentId: any,
            term: string,
            storedFields?: Record<string, unknown>,
        ) => number;
        boostTerm?: (term: string, i: number, terms: string[]) => number;
        combineWith?: CombinationOperator;
        fields?: string[];
        filter?: (result: SearchResult) => boolean;
        fuzzy?:
            | boolean
            | number
            | ((term: string, index: number, terms: string[]) => boolean | number);
        limit?: number;
        maxFuzzy?: number;
        prefix?:
            | boolean
            | ((term: string, index: number, terms: string[]) => boolean);
        processTerm?: (
            term: string,
        ) => string | string[] | null | undefined | false;
        tokenize?: (text: string) => string[];
        weights?: { fuzzy: number; prefix: number };
    }

    Hierarchy (View Summary)

    Index
    bm25?: BM25Params

    BM25+ algorithm parameters. Customizing these is almost never necessary.

    boost?: { [fieldName: string]: number }

    Key-value object of field names to boosting values. By default, fields are assigned a boosting factor of 1. If one assigns to a field a boosting value of 2, a result that matches the query in that field is assigned a score twice as high as a result matching the query in another field, all else being equal.

    boostDocument?: (
        documentId: any,
        term: string,
        storedFields?: Record<string, unknown>,
    ) => number

    Function to calculate a boost factor for documents. It takes as arguments the document ID, and a term that matches the search in that document, and the value of the stored fields for the document (if any). A falsy value skips the search result completely.

    boostTerm?: (term: string, i: number, terms: string[]) => number

    Function to calculate a boost factor for each query term. Returning a factor lower than 1 reduces the importance of the term, greater than 1 increases it, and exactly 1 is neutral.

    combineWith?: CombinationOperator

    The operand to combine partial results for each term. Defaults to "OR".

    fields?: string[]

    Names of the fields to search in. If omitted, all fields are searched.

    filter?: (result: SearchResult) => boolean

    Function used to filter search results, for example on the basis of stored fields. It takes as argument each search result and should return a boolean to indicate if the result should be kept or not.

    fuzzy?:
        | boolean
        | number
        | ((term: string, index: number, terms: string[]) => boolean | number)

    Controls whether to perform fuzzy search. Either a boolean (default fuzziness), a number (explicit edit distance ≥ 1, or fractional 0–1 of the term length), or a function returning either.

    limit?: number

    FrozenMiniSearch extension (not in MiniSearch): return at most limit results. For finite scores and a deterministic filter that does not change scores, the result equals an unbounded search followed by .slice(0, limit). Zero returns an empty array without executing the query or its callbacks. Invalid limits throw before query execution. Must be a non-negative integer or Infinity; ignored by autoSuggest. Infinity or an explicit undefined removes an index-level default limit.

    When the limit is smaller than the raw candidate count, only retained results are materialized without a filter. With a filter, candidates are materialized in descending score order (insertion order for an unboosted wildcard) until enough are accepted. Filters should not depend on invocation order or count: an unbounded search filters before sorting. An unboosted wildcard stops scanning documents once enough are accepted; other queries still compute all candidate scores before selection.

    maxFuzzy?: number

    Maximum fuzziness when using a fractional fuzzy value. Defaults to 6.

    prefix?: boolean | ((term: string, index: number, terms: string[]) => boolean)

    Controls whether to perform prefix search. Either a boolean, or a function called per query term that returns a boolean.

    processTerm?: (term: string) => string | string[] | null | undefined | false

    Function to process or normalize terms in the search query. By default, the same term processor used for indexing is used also for search.

    tokenize?: (text: string) => string[]

    Function to tokenize the search query. By default, the same tokenizer used for indexing is used also for search.

    weights?: { fuzzy: number; prefix: number }

    Relative weights to assign to prefix search results and fuzzy search results. Exact matches are assigned a weight of 1.