feat(retriever): add level filter to find with retriever-level filtering, preserving recursive navigation#1988
Merged
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
35d5255 to
dc8bed0
Compare
qin-ctx
reviewed
May 13, 2026
qin-ctx
reviewed
May 13, 2026
qin-ctx
reviewed
May 13, 2026
…ing, preserving recursive navigation Add level: Optional[List[int]] parameter to find API/CLI/SDK to filter results by L0 (abstract), L1 (overview), L2 (original file). Key design: filter at two result collection points inside HierarchicalRetriever (global search pool + recursive traversal pool), NOT at vector search layer or post-filter layer. This preserves L0/L1 directory waypoints in dir_queue for recursive navigation, avoiding the quality regression that merge_level_filter (PR volcengine#1980) causes. Changes: - Python: FindRequest, SearchService, VikingFS, LocalClient, AsyncOpenViking, SyncOpenViking, MCP endpoint all pass level through - Retriever: initial_candidates and collected_by_uri filtered by level; dir_queue navigation unchanged - Fix variable shadowing: rename debug loop 'level' to 'result_level' - Add stagnation detection to convergence check when level filter prevents reaching limit - CLI: --level / -L flag with Option<Vec<i32>> + value_delimiter - Remove merge_level_filter from find route (breaks recursive navigation) - Tests: 8 new test cases covering param passthrough, backward compat, single/mixed level filtering, and edge cases
dc8bed0 to
08ef4b8
Compare
- HTTP 路由层:FindRequest.level 改为 Union[int, str, List[int]],search 路由传递 level 参数 - Service 层:SearchService.search 增加 level 参数 - 存储层:VikingFS.search 增加 level 参数,传递给 retriever.retrieve - SDK 层:LocalClient/AsyncOpenViking/SyncOpenViking.search 增加 level 参数 - MCP 端点:search 工具增加 level 参数 - CLI 层:ov search --level 从 Option<String> 改为 Option<Vec<i32>>,与 find 一致 - 删除 append_level_filter_params,改用内联格式化 - 路由层用 _resolve_levels() 统一将 Union 类型转为 List[int] - 新增 9 个测试:7 个 search level 测试 + 2 个 find Union 类型输入测试
qin-ctx
approved these changes
May 14, 2026
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.
Description
为 find 功能添加 level 过滤能力,支持按 L0(摘要)、L1(概览)、L2(原始文件)级别筛选返回结果。
核心设计
过滤逻辑在 HierarchicalRetriever 的两个结果收集点实现,而非在向量搜索层或后过滤层:
关键点 :递归导航逻辑( dir_queue )不受 level 影响,L0/L1 目录仍正常进入导航队列,保证递归搜索质量不下降。
Type of Change
Changes Made
Python 层
Rust CLI 层
测试
Usage Examples
HTTP API
CLI
Python SDK
Testing
测试命令:
测试结果:8 passed
Checklist