FunctionaddAllAsync

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
    • Document
    • Index extends Record<string, any> = Record<never, never>

    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 to undefined when the indexing is done