mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #19602] [MERGED] fix: Update milvus.py #40891
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/19602
Author: @Classic298
Created: 11/30/2025
Status: ✅ Merged
Merged: 12/2/2025
Merged by: @tjbck
Base:
dev← Head:milvus-test📝 Commits (10+)
fe6783cMerge pull request #19030 from open-webui/devfc05e0aMerge pull request #19405 from open-webui/deve3faec6Merge pull request #19416 from open-webui/dev9899293Merge pull request #19448 from open-webui/dev140605eMerge pull request #19462 from open-webui/deve9d0cb0Update milvus.py03d7acfUpdate milvus.py5f4d13fUpdate milvus.py7eba3e2Update milvus.py319e0c3Merge branch 'open-webui:main' into milvus-test📊 Changes
1 file changed (+17 additions, -15 deletions)
View changed files
📝
backend/open_webui/retrieval/vector/dbs/milvus.py(+17 -15)📄 Description
devbranch. Not targeting thedevbranch will lead to immediate closure of the PR.Changelog Entry
Description
Fixes: https://github.com/open-webui/open-webui/discussions/18119
Fixes: https://github.com/open-webui/open-webui/discussions/16345
Fixes: https://github.com/open-webui/open-webui/issues/17088
Fixes: https://github.com/open-webui/open-webui/issues/18485
Why This Was Necessary (The Problem)
Root Cause: Milvus's query_iterator() method has a bug where it ignores JSON metadata field filters.
Evidence from Testing:
When querying for metadata["hash"] == "abc123...":
Why It Manifested:
When uploading a second file to a knowledge base:
How The Fix Works (The Mechanism)
1. Proper String Quote Handling
Milvus requires string values in filter expressions to be explicitly quoted:
By checking isinstance(value, str), we add quotes only when needed.
2. Direct Query Method
The collection.query() method (not iterator):
We confirmed this works because:
**- Testing showed query() returns 0 results when no hash matches (correct!)
3. Limit Adjustment
query() requires a positive limit, while query_iterator() accepted -1 (unlimited):
limit=limit if limit > 0 else 16384 # Milvus max limitAdditional Information
Tested locally
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.