fix(search): Refactor search tests to use unified search API and update text index type casting
This commit is contained in:
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartdata',
|
||||
version: '5.9.0',
|
||||
version: '5.9.1',
|
||||
description: 'An advanced library for NoSQL data organization and manipulation using TypeScript with support for MongoDB, data validation, collections, and custom data types.'
|
||||
}
|
||||
|
@ -158,9 +158,11 @@ export class SmartdataCollection<T> {
|
||||
// Auto-create a compound text index on all searchable fields
|
||||
const searchableFields = getSearchableFields(this.collectionName);
|
||||
if (searchableFields.length > 0 && !this.textIndexCreated) {
|
||||
const indexSpec: { [key: string]: string } = {};
|
||||
// Build a compound text index spec
|
||||
const indexSpec: Record<string, 'text'> = {};
|
||||
searchableFields.forEach(f => { indexSpec[f] = 'text'; });
|
||||
await this.mongoDbCollection.createIndex(indexSpec, { name: 'smartdata_text_index' });
|
||||
// Cast to any to satisfy TypeScript IndexSpecification typing
|
||||
await this.mongoDbCollection.createIndex(indexSpec as any, { name: 'smartdata_text_index' });
|
||||
this.textIndexCreated = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user