diff --git a/packages/components/nodes/vectorstores/Milvus/Milvus_Existing.ts b/packages/components/nodes/vectorstores/Milvus/Milvus_Existing.ts index 514fdc73..3e9b125f 100644 --- a/packages/components/nodes/vectorstores/Milvus/Milvus_Existing.ts +++ b/packages/components/nodes/vectorstores/Milvus/Milvus_Existing.ts @@ -21,7 +21,7 @@ class Milvus_Existing_VectorStores implements INode { constructor() { this.label = 'Milvus Load Existing collection' this.name = 'milvusExistingCollection' - this.version = 1.0 + this.version = 2.0 this.type = 'Milvus' this.icon = 'milvus.svg' this.category = 'Vector Stores' @@ -50,6 +50,25 @@ class Milvus_Existing_VectorStores implements INode { label: 'Milvus Collection Name', name: 'milvusCollection', type: 'string' + }, + { + label: 'Milvus Filter', + name: 'milvusFilter', + type: 'string', + optional: true, + description: + 'Filter data with a simple string query. Refer Milvus docs for more details.', + placeholder: 'doc=="a"', + additionalParams: true + }, + { + label: 'Top K', + name: 'topK', + description: 'Number of top results to fetch. Default to 4', + placeholder: '4', + type: 'number', + additionalParams: true, + optional: true } ] this.outputs = [ @@ -70,6 +89,7 @@ class Milvus_Existing_VectorStores implements INode { // server setup const address = nodeData.inputs?.milvusServerUrl as string const collectionName = nodeData.inputs?.milvusCollection as string + const milvusFilter = nodeData.inputs?.milvusFilter as string // embeddings const embeddings = nodeData.inputs?.embeddings as Embeddings @@ -109,7 +129,7 @@ class Milvus_Existing_VectorStores implements INode { throw new Error(`Collection not found: ${vectorStore.collectionName}, please create collection before search.`) } - const filterStr = filter ?? '' + const filterStr = milvusFilter ?? filter ?? '' await vectorStore.grabCollectionFields()