perf(retrieval): parallelize hierarchical child search#2155
Merged
Conversation
Batch child directory vector lookups during recursive retrieval to reduce remote fan-out latency, and accept alternate count aggregate total keys from vector stores.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
zhoujh01
approved these changes
May 21, 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
Parallelizes recursive hierarchical child directory searches with bounded per-request fan-out, and makes vector collection count parsing accept multiple aggregate total key names returned by different vector backends.
Related Issue
N/A
Type of Change
Changes Made
HierarchicalRetrieverusingasyncio.gather._total,__TOTAL__, and__total_count__aggregate keys when parsing vector collection counts.Testing
Local checks:
git diff --check.venv/bin/ruff check openviking/retrieve/hierarchical_retriever.py openviking/storage/vectordb_adapters/base.py.venv/bin/ruff format --check openviking/retrieve/hierarchical_retriever.py openviking/storage/vectordb_adapters/base.py.venv/bin/python -m pytest tests/retrieve/test_hierarchical_retriever_rerank.py tests/retrieve/test_hierarchical_retriever_target_dirs.py(9 passed, 1 failed:tests/retrieve/test_hierarchical_retriever_rerank.py::test_retrieve_reranks_level_two_initial_candidates_in_thinking_mode; failure is in existing initial-candidate threshold behavior not changed by this PR)Note: plain
python -m pytest ...does not run in this local environment because system Python has incompatiblepydantic/pydantic-coreversions.Checklist
Screenshots (if applicable)
N/A
Additional Notes
The local pre-commit hook could not run because it invokes a system Python without the
pre_commitmodule installed. I ran the equivalent configured Ruff checks manually from the repository virtual environment before committing.