@yoch/frozenminisearch v1.3.0
    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);
        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 };
    }
    Index

    Properties

    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.

    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.