fix: apply payload filters before top-k truncation - #8
Open
Youzini-afk wants to merge 3 commits into
Open
Conversation
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.
背景
修复 #7:
payload_filter与较小的top_k同时使用时,高分但不匹配过滤条件的节点会先占用 Top-K 名额,导致真正匹配的结果被截断,最终返回空结果或数量不足。根因是 brute-force 路径将过滤失败的节点映射为 ID 0,而不是从候选集中移除;这些占位结果仍参与排序和
truncate(top_k)。主要改动
brute_force::searchAPI 不变。+0.0与-0.0使用相同规范表示。u64::MAX,并在普通写入、事务预检及 WAL 回放中避免 ID 溢出回绕。兼容性与性能
brute_force::search函数签名和既有 mapper 调用语义保持不变。top_k时,才会触发 O(N) 精确回退。SEARCH ... WHERE和图扩散的既有语义。验证
cargo test --lib --testscargo test -p triviumdb-cli(71 个单元测试 + 19 个命令测试)cargo clippy --lib --tests -- -D warningscargo check --workspacecargo check --lib --features python,nodejscargo test --docgit diff --check以上均通过。Python/Node 特性检查仅保留一个既有的 Node
json_to_filterdead-code warning。Fixes #7