Type Alias SearchResult<ID, Index>

SearchResult<ID, Index>: Index & {
    id: ID;
    match: MatchInfo;
    queryTerms: string[];
    score: number;
    terms: string[];
}

Type of the search results. Each search result indicates the document ID, the terms that matched, the match information, the score, and all the stored fields.

Type Parameters

  • ID = any

    The type of id being indexed.

  • Index extends Record<string, any> = Record<never, never>

    The type of the documents being indexed.

Type declaration

  • id: ID

    The document ID

  • match: MatchInfo

    Match information, see MatchInfo

  • queryTerms: string[]

    List of query terms that matched. For example, if a prefix search for "moto" matches "motorcycle", queryTerms will contain "moto".

  • score: number

    Score of the search results

  • terms: string[]

    List of document terms that matched. For example, if a prefix search for "moto" matches "motorcycle", terms will contain "motorcycle".