Function addAllAsync

Adds all the given documents to the index asynchronously.

Returns a promise that resolves (to undefined) when the indexing is done. This method is useful when index many documents, to avoid blocking the main thread. The indexing is performed asynchronously and in chunks.

  • Type Parameters

    • ID

      The id type of the documents being indexed.

    • Document

      The type of the documents being indexed.

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

      The type of the documents being indexed.

    Parameters

    • searchIndex: SearchIndex<ID, Document, Index>

      The search index

    • documents: readonly Document[]

      An array of documents to be indexed

    • options: {
          chunkSize?: number;
      } = {}

      Configuration options

      • OptionalchunkSize?: number

    Returns Promise<void>

    A promise resolving when the indexing is done