ioredisearch
Version:
Client library for RediSearch Redis Module, designed to work in conjunction with ioredis
33 lines (32 loc) • 1.06 kB
TypeScript
import { Client } from './client';
import { DocumentScore, SchemaDictionary } from './ioredisearch';
/**
* Helper document interface for batch operations
*/
export interface BatchDoc<T extends SchemaDictionary> {
docId: string;
fields: T;
score?: DocumentScore;
payload?: Object;
}
/**
* A batch indexer allows you to automatically batch
* document indexing in pipelines, flushing it every N documents.
*/
export declare class BatchIndexer {
private client;
private pipeline;
private chunkSize;
constructor(client: Client, chunkSize?: number);
/**
* Add multiple documents via Redis pipelining
* @param docs array of objects containing document related properties
* (score defaults to 1.0 if omitted)
*/
addDocuments<T extends SchemaDictionary>(docs: BatchDoc<T>[], noSave?: boolean, replace?: boolean, partial?: boolean): Promise<'OK'>;
private partialAddDoc<T>(noSave, replace, partial);
/**
* Manually commit and flush the batch indexing query
*/
private commit();
}