@resistdesign/voltra
    Preparing search index...

    Class ExactIndex

    In-memory exact index for token positions and phrase checks.

    Index

    Methods

    • Add a document by enumerating positions for each token.

      Parameters

      • docId: DocId

        Document id to add.

      • indexField: string

        Field name the tokens are indexed under.

      • tokens: string[]

        Token list for the document.

      Returns void

      Nothing.

    • Add exact token positions for a document.

      Parameters

      • token: string

        Token value to store positions for.

      • indexField: string

        Field name the token was indexed under.

      • docId: DocId

        Document id containing the token.

      • positions: number[]

        Token positions within the document.

      Returns void

      Nothing.

    • Load exact positions for a token in a document.

      Parameters

      • token: string

        Token value to retrieve positions for.

      • indexField: string

        Field name the token was indexed under.

      • docId: DocId

        Document id containing the token.

      Returns number[] | undefined

      Positions array or undefined if not found.

    • Check if a document contains an exact phrase.

      Parameters

      • docId: DocId

        Document id to verify.

      • indexField: string

        Field name the tokens are indexed under.

      • phraseTokens: string[]

        Token sequence representing the phrase.

      Returns boolean

      True when the phrase exists in the document.

    • Remove exact token positions for a document.

      Parameters

      • token: string

        Token value to remove positions for.

      • indexField: string

        Field name the token was indexed under.

      • docId: DocId

        Document id containing the token.

      Returns void

      Nothing.

    • Verify candidate documents against a phrase, with optional paging.

      Parameters

      • phraseTokens: string[]

        Token sequence representing the phrase.

      • indexField: string

        Field name the tokens are indexed under.

      • candidates: DocId[]

        Candidate document ids to verify.

      • options: ExactQueryOptions = {}

        Paging options for verification.

      Returns ExactQueryResult

      Verified results and optional next cursor.