Skip to content

Commit b193782

Browse files
authored
Merge pull request #925 from FlowiseAI/feature/Milvus
Feature/Add filter to milvus
2 parents 0c71e62 + 18079d2 commit b193782

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

packages/components/nodes/vectorstores/Milvus/Milvus_Existing.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Milvus_Existing_VectorStores implements INode {
2121
constructor() {
2222
this.label = 'Milvus Load Existing collection'
2323
this.name = 'milvusExistingCollection'
24-
this.version = 1.0
24+
this.version = 2.0
2525
this.type = 'Milvus'
2626
this.icon = 'milvus.svg'
2727
this.category = 'Vector Stores'
@@ -50,6 +50,25 @@ class Milvus_Existing_VectorStores implements INode {
5050
label: 'Milvus Collection Name',
5151
name: 'milvusCollection',
5252
type: 'string'
53+
},
54+
{
55+
label: 'Milvus Filter',
56+
name: 'milvusFilter',
57+
type: 'string',
58+
optional: true,
59+
description:
60+
'Filter data with a simple string query. Refer Milvus <a target="_blank" href="https://milvus.io/blog/2022-08-08-How-to-use-string-data-to-empower-your-similarity-search-applications.md#Hybrid-search">docs</a> for more details.',
61+
placeholder: 'doc=="a"',
62+
additionalParams: true
63+
},
64+
{
65+
label: 'Top K',
66+
name: 'topK',
67+
description: 'Number of top results to fetch. Default to 4',
68+
placeholder: '4',
69+
type: 'number',
70+
additionalParams: true,
71+
optional: true
5372
}
5473
]
5574
this.outputs = [
@@ -70,6 +89,7 @@ class Milvus_Existing_VectorStores implements INode {
7089
// server setup
7190
const address = nodeData.inputs?.milvusServerUrl as string
7291
const collectionName = nodeData.inputs?.milvusCollection as string
92+
const milvusFilter = nodeData.inputs?.milvusFilter as string
7393

7494
// embeddings
7595
const embeddings = nodeData.inputs?.embeddings as Embeddings
@@ -109,7 +129,7 @@ class Milvus_Existing_VectorStores implements INode {
109129
throw new Error(`Collection not found: ${vectorStore.collectionName}, please create collection before search.`)
110130
}
111131

112-
const filterStr = filter ?? ''
132+
const filterStr = milvusFilter ?? filter ?? ''
113133

114134
await vectorStore.grabCollectionFields()
115135

0 commit comments

Comments
 (0)