fix(milvus): Fix milvus store search with topk always set to 4 #2131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Previously, the search topk in Milvus storage was always fixed at 4. This commit fixes the issue by allowing users to specify topk dynamically.
How Has This Been Tested?
When the parameter
VECTOR_STORE_TYPE
is set toMilvus
, theKNOWLEDGE_SEARCH_TOP_SIZE
parameter becomes ineffective, and the system can only match up to 4 documents from the Milvus database. The issue lies in the _search method of the MilvusStore class, where the letterk
represents the meaning of topk and is set to a default value of 4. However, during the method call, the keyword argument passed istopk
(instead ofk
), causing the parameter to be ignored and the value ofk
to remain fixed at the default value of 4.After I modified the keyword argument passed during the method call, the KNOWLEDGE_SEARCH_TOP_SIZE parameter started working as expected.
Snapshots:
Include snapshots for easier review.
Checklist: