SearchIndexingBufferedSender class
Class used to perform buffered operations against a search index, including adding, updating, and removing them.
Constructors
Search |
Creates a new instance of SearchIndexingBufferedSender. |
Methods
Constructor Details
SearchIndexingBufferedSender<TModel>(IndexDocumentsClient<TModel>, (document: TModel) => string, SearchIndexingBufferedSenderOptions)
Creates a new instance of SearchIndexingBufferedSender.
new SearchIndexingBufferedSender(client: IndexDocumentsClient<TModel>, documentKeyRetriever: (document: TModel) => string, options?: SearchIndexingBufferedSenderOptions)
Parameters
- client
-
IndexDocumentsClient<TModel>
Search Client used to call the underlying IndexBatch operations.
- documentKeyRetriever
-
(document: TModel) => string
Options to modify auto flush.
Method Details
deleteDocuments(TModel[], OperationOptions)
Deletes the documents/Adds the documents to the delete queue.
function deleteDocuments(documents: TModel[], options?: OperationOptions): Promise<void>
Parameters
- documents
-
TModel[]
Documents to be deleted.
- options
- OperationOptions
Upload options.
Returns
Promise<void>
dispose()
If using autoFlush: true, call this to cleanup the autoflush timer.
function dispose(): Promise<void>
Returns
Promise<void>
flush(OperationOptions)
Flushes the queue manually.
function flush(options?: OperationOptions): Promise<void>
Parameters
- options
- OperationOptions
Flush options.
Returns
Promise<void>
mergeDocuments(TModel[], OperationOptions)
Merges the documents/Adds the documents to the merge queue.
function mergeDocuments(documents: TModel[], options?: OperationOptions): Promise<void>
Parameters
- documents
-
TModel[]
Documents to be merged.
- options
- OperationOptions
Upload options.
Returns
Promise<void>
mergeOrUploadDocuments(TModel[], OperationOptions)
Merges/Uploads the documents/Adds the documents to the merge/upload queue.
function mergeOrUploadDocuments(documents: TModel[], options?: OperationOptions): Promise<void>
Parameters
- documents
-
TModel[]
Documents to be merged/uploaded.
- options
- OperationOptions
Upload options.
Returns
Promise<void>
off("batchAdded", (e: { action: string, documents: TModel[] }) => void)
Detach Batch Added Event
function off(event: "batchAdded", listener: (e: { action: string, documents: TModel[] }) => void)
Parameters
- event
-
"batchAdded"
Event to be emitted
- listener
-
(e: { action: string, documents: TModel[] }) => void
Event Listener
off("batchFailed", (e: RestError) => void)
Detach Batch Failed Event
function off(event: "batchFailed", listener: (e: RestError) => void)
Parameters
- event
-
"batchFailed"
Event to be emitted
- listener
-
(e: RestError) => void
Event Listener
off("batchSucceeded", (e: IndexDocumentsResult) => void)
Detach Batch Succeeded Event
function off(event: "batchSucceeded", listener: (e: IndexDocumentsResult) => void)
Parameters
- event
-
"batchSucceeded"
Event to be emitted
- listener
-
(e: IndexDocumentsResult) => void
Event Listener
off("beforeDocumentSent", (e: IndexDocumentsAction<TModel>) => void)
Detach Batch Sent Event
function off(event: "beforeDocumentSent", listener: (e: IndexDocumentsAction<TModel>) => void)
Parameters
- event
-
"beforeDocumentSent"
Event to be emitted
- listener
-
(e: IndexDocumentsAction<TModel>) => void
Event Listener
on("batchAdded", (e: { action: string, documents: TModel[] }) => void)
Attach Batch Added Event
function on(event: "batchAdded", listener: (e: { action: string, documents: TModel[] }) => void)
Parameters
- event
-
"batchAdded"
Event to be emitted
- listener
-
(e: { action: string, documents: TModel[] }) => void
Event Listener
on("batchFailed", (e: RestError) => void)
Attach Batch Failed Event
function on(event: "batchFailed", listener: (e: RestError) => void)
Parameters
- event
-
"batchFailed"
Event to be emitted
- listener
-
(e: RestError) => void
Event Listener
on("batchSucceeded", (e: IndexDocumentsResult) => void)
Attach Batch Succeeded Event
function on(event: "batchSucceeded", listener: (e: IndexDocumentsResult) => void)
Parameters
- event
-
"batchSucceeded"
Event to be emitted
- listener
-
(e: IndexDocumentsResult) => void
Event Listener
on("beforeDocumentSent", (e: IndexDocumentsAction<TModel>) => void)
Attach Batch Sent Event
function on(event: "beforeDocumentSent", listener: (e: IndexDocumentsAction<TModel>) => void)
Parameters
- event
-
"beforeDocumentSent"
Event to be emitted
- listener
-
(e: IndexDocumentsAction<TModel>) => void
Event Listener
uploadDocuments(TModel[], OperationOptions)
Uploads the documents/Adds the documents to the upload queue.
function uploadDocuments(documents: TModel[], options?: OperationOptions): Promise<void>
Parameters
- documents
-
TModel[]
Documents to be uploaded.
- options
- OperationOptions
Upload options.
Returns
Promise<void>