Repository navigation
fix(knowledge): 绑定活动文件清单并在 Milvus 召回前排除残留 - #1216
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
简介
感谢 @PlankBevelen 在 #1206 指出,按活动文件逐个拼入 ID 会使 Milvus 解析的表达式随文件数量膨胀。原方案省略占多数代次的文件清单。对原 head
a20c235的真实 Milvus 验证发现,已删除文件留下的同代高分记录可以占满 top-k。随后 PostgreSQL 核对来源会丢弃该命中,使本应返回的有效文件落选。此实现按活动代次分组,用 PyMilvus 模板参数绑定各组的有效文件 ID。在 Milvus 取 top-k 前就排除残留,同一批代次增加文件时表达式文本长度保持稳定。
具体改动与影响
向量、BM25、混合检索的两个子请求和图候选复核共用活动范围。空清单匹配零条。已有集合无需迁移。
实现依据与设计取舍
PostgreSQL 文件仓储拥有活动文件和代次,Milvus 检索负责在召回前执行成员约束。结果正文和来源仍从 PostgreSQL 回读。决策记录
验证情况
pytest test/e2e/test_milvus_text_retrieval_e2e.py。单条窗口内注入同代高分残留,原 head 回归用例失败;修复后向量、BM25、混合模式均返回预期有效文件和正文(1 passed)。pytest test/unit -m "not slow"4124 passed、128 skipped,7 个 subtests passed。工程契约检查通过,契约脚本单测 56 项通过,Ruff 和文档构建通过。git diff --check origin/main...HEAD通过。独立审阅与未验证范围
本次发布复用已通过独立审阅的提交 326a123。表达式文本随不同代次数增长,绑定参数总量仍随有效文件数增长。未测 RPC 序列化载荷字节数、消息大小上限及生产延迟。
关联事项
替代 #1206。