From 86aa9d9b614245978dde2b06f01255d1017a0572 Mon Sep 17 00:00:00 2001 From: Tommy Smith Date: Wed, 13 Nov 2024 14:54:32 +0000 Subject: [PATCH] Add missing `filterStrategy` to configure/reconfigure hnsw methods --- src/collections/configure/types/vectorIndex.ts | 2 ++ src/collections/configure/unit.test.ts | 2 ++ src/collections/configure/vectorIndex.ts | 9 ++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/collections/configure/types/vectorIndex.ts b/src/collections/configure/types/vectorIndex.ts index d41230fc..4f759a7f 100644 --- a/src/collections/configure/types/vectorIndex.ts +++ b/src/collections/configure/types/vectorIndex.ts @@ -126,6 +126,8 @@ export type VectorIndexConfigHNSWCreateOptions = { efConstruction?: number; /** The flat search cutoff. Default is 40000. */ flatSearchCutoff?: number; + /** The filter strategy to use. Default is 'sweeping'. */ + filterStrategy?: VectorIndexFilterStrategy; /** The maximum number of connections. Default is 64. */ maxConnections?: number; /** The quantizer configuration to use. Use `vectorIndex.quantizer.bq` or `vectorIndex.quantizer.pq` to make one. */ diff --git a/src/collections/configure/unit.test.ts b/src/collections/configure/unit.test.ts index 3ced80d4..cef6b655 100644 --- a/src/collections/configure/unit.test.ts +++ b/src/collections/configure/unit.test.ts @@ -138,6 +138,7 @@ describe('Unit testing of the configure & reconfigure factory classes', () => { ef: 100, efConstruction: 256, flatSearchCutoff: 80000, + filterStrategy: 'acorn', maxConnections: 128, quantizer: configure.vectorIndex.quantizer.pq({ bitCompression: true, @@ -163,6 +164,7 @@ describe('Unit testing of the configure & reconfigure factory classes', () => { ef: 100, efConstruction: 256, flatSearchCutoff: 80000, + filterStrategy: 'acorn', maxConnections: 128, quantizer: { bitCompression: true, diff --git a/src/collections/configure/vectorIndex.ts b/src/collections/configure/vectorIndex.ts index 9f055677..a9e8790e 100644 --- a/src/collections/configure/vectorIndex.ts +++ b/src/collections/configure/vectorIndex.ts @@ -1,4 +1,9 @@ -import { ModuleConfig, PQEncoderDistribution, PQEncoderType, VectorDistance } from '../config/types/index.js'; +import { + ModuleConfig, + PQEncoderDistribution, + PQEncoderType, + VectorIndexFilterStrategy, +} from '../config/types/index.js'; import { BQConfigCreate, BQConfigUpdate, @@ -187,6 +192,7 @@ const reconfigure = { * @param {number} [options.dynamicEfMax] The dynamic ef max. Default is 500. * @param {number} [options.dynamicEfMin] The dynamic ef min. Default is 100. * @param {number} [options.ef] The ef parameter. Default is -1. + * @param {VectorIndexFilterStrategy} [options.filterStrategy] The filter strategy. Default is 'sweeping'. * @param {number} [options.flatSearchCutoff] The flat search cutoff. Default is 40000. * @param {PQConfigUpdate | BQConfigUpdate} [options.quantizer] The quantizer configuration to use. Use `vectorIndex.quantizer.bq` or `vectorIndex.quantizer.pq` to make one. * @param {number} [options.vectorCacheMaxObjects] The maximum number of objects to cache in the vector cache. Default is 1000000000000. @@ -197,6 +203,7 @@ const reconfigure = { dynamicEfMax?: number; dynamicEfMin?: number; ef?: number; + filterStrategy?: VectorIndexFilterStrategy; flatSearchCutoff?: number; quantizer?: PQConfigUpdate | BQConfigUpdate | SQConfigUpdate; vectorCacheMaxObjects?: number;