fix(hgraph): expose skip_ratio and skip_strategy search parameters (v0.18 backport)#2369
fix(hgraph): expose skip_ratio and skip_strategy search parameters (v0.18 backport)#2369LHT129 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 parameters in HGraph search parameters, including parsing them from JSON and propagating them to the search parameters. The feedback suggests: 1) correcting a test case to use the supported RANDOM strategy instead of PROBABILISTIC to avoid compilation failures; 2) propagating these parameters in standard KNN and Range search paths (SearchWithRequest and RangeSearch) so they are not ignored; and 3) adding validation to ensure skip_ratio is within the valid range of [0.0, 1.0].
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.
2bac350 to
60f2910
Compare
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## 0.18 #2369 +/- ##
==========================================
- Coverage 91.45% 91.44% -0.02%
==========================================
Files 330 330
Lines 19627 19638 +11
==========================================
+ Hits 17950 17958 +8
- Misses 1677 1680 +3
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:
|
67ef682 to
9b8102d
Compare
9b8102d to
8b98440
Compare
|
/label S-waiting-on-review |
dca040e to
e19b677
Compare
…0.18 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
e19b677 to
f376f8d
Compare
Backport of #2367 to v0.18 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.