tsbase
    Preparing search index...

    Interface ISearchIndex<T>

    A collection where all representations (T) of data (D) are indexed upon insertion for efficient querying based on given configuration Use cases include:

    • Search feature which returns relevant results with the option to support "autocomplete" functionality
    • Answering potentially complex but predictable questions based on parameters of an "indexer" function
    interface ISearchIndex<T> {
        Answer(query: string): Promise<null | T>;
        GetIndexesForQuery(query: string, limit?: number): Promise<string[]>;
        Insert<D>(indexer: Indexer<D, T>, data?: D[]): Promise<void>;
        Reset(): void;
        Search(query: string, limit?: number): Promise<T[]>;
    }

    Type Parameters

    • T

    Implemented by

    Index

    Methods

    • Return the best match indexes for a given query (consider for an autocomplete feature)

      Parameters

      • query: string
      • Optionallimit: number

      Returns Promise<string[]>