Fanis Tharropoulos
07/24/2024, 9:36 AMdeleteIfExists
. Also, I'd avoid using so many any
type defs, I'd probably use a Generic for data, and use it in the batchData
Generic slot. Also, I'd use the CollectionCreateSchema
specified in here
export interface CollectionCreateSchema {
name: string;
default_sorting_field?: string;
fields?: CollectionFieldSchema[];
symbols_to_index?: string[];
token_separators?: string[];
enable_nested_fields?: boolean;
metadata?: object;
voice_query_model?: {
model_name?: string;
};
}
for the schema
type. Finally, maybe pass the batch size as an argument to the function, instead of hard coding it? And maybe use Array.prototype.forEach
instead of the for...of
iterator? Just a personal preference at this point. Not really a Typesense specific problem, rather than some Typescript points