fix(hgraph): expose skip_ratio and skip_strategy search parameters (v0.17 backport)#2370
fix(hgraph): expose skip_ratio and skip_strategy search parameters (v0.17 backport)#2370LHT129 wants to merge 1 commit into
Conversation
Merge Protections🟢 Merge protection satisfied — ready to merge. Show 1 satisfied protection🟢 Require linked issue for feature/bug PRs
|
There was a problem hiding this comment.
Code Review
This pull request adds support for configuring skip_ratio and skip_strategy_type in HGraphSearchParameters, including parsing them from JSON and passing them during a KNN search. However, the reviewer noted that these parameters are missing from other key search paths (SearchWithRequest and RangeSearch), meaning custom configurations would be ignored there. Additionally, a formatting regression in the test file needs to be corrected.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
f1f6203 to
f939d95
Compare
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## 0.17 #2370 +/- ##
==========================================
- Coverage 91.94% 91.45% -0.49%
==========================================
Files 320 320
Lines 17848 17856 +8
==========================================
- Hits 16410 16331 -79
- Misses 1438 1525 +87
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
6647f8d to
5883142
Compare
5883142 to
62ceae2
Compare
|
/label S-waiting-on-review |
62ceae2 to
780f6e6
Compare
42e0fc4 to
aca0ad8
Compare
…0.17 backport) Expose skip_ratio and skip_strategy as configurable search parameters for HGraph index. These parameters control the filter skip strategy during graph traversal, allowing users to tune the trade-off between search speed and recall when using filters. Key changes: - Add skip_ratio and skip_strategy_type fields to HGraphSearchParameters - Parse these parameters from JSON in FromJson() - Add validation for skip_ratio range [0.0, 1.0] - Pass parameters to InnerSearchParam in both KnnSearch and SearchWithRequest paths - Invert skip_ratio semantics to match parameter name meaning: skip_ratio now means "what percentage of invalid points to skip" - Remove special case for valid_ratio==1.0 in get_retain_ratio - Add unit tests for parameter parsing and validation - Update test comments with correct formula skip_ratio semantics (after inversion): - skip_ratio=0.2 (default): skip 20% of invalid points - retain_ratio = (1 - valid_ratio) * (1 - skip_ratio) - visit_ratio = valid_ratio + retain_ratio The underlying skip mechanism was already supported in BasicSearcher/ ParallelSearcher since v0.17.0, but was never exposed through the public API for HGraph. This change maintains backward compatibility by using the same default value (0.2) that was previously hardcoded. Fixes: antgroup#2368 Signed-off-by: LHT129 <tianlan.lht@antgroup.com> Assisted-by: opencode:qwen3.7-plus
aca0ad8 to
040a7ff
Compare
Backport of #2367 to v0.17 branch.
Fixes #2368
Breaking Change: skip_ratio semantics inverted
The skip_ratio parameter semantics have been inverted to match the parameter name.
Before: skip_ratio=0.8 meant visit 80% of invalid points.
After: skip_ratio=0.2 means skip 20% of invalid points (visit 80%).
Default values changed: HGraph 0.8 to 0.2, HNSW 0.9 to 0.1.
If using custom skip_ratio values, change to (1 - old_value) to maintain same behavior.
Breaking Change: skip_ratio semantics inverted
The skip_ratio parameter semantics have been inverted to match the parameter name.
Before: skip_ratio=0.8 meant visit 80% of invalid points.
After: skip_ratio=0.2 means skip 20% of invalid points (visit 80%).
Default values changed: HGraph 0.8 to 0.2, HNSW 0.9 to 0.1.
If using custom skip_ratio values, change to (1 - old_value) to maintain same behavior.