Implement filter search for disk path using AdpativeL#1173
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an AdaptiveL-enabled, inline label-filtered graph-search path for disk index search, wiring it through DiskIndexSearcher while keeping existing behavior unchanged when AdaptiveL is not provided.
Changes:
- Add
adaptive_l: Option<AdaptiveL>toDiskIndexSearcher::search/search_internaland dispatch to anInlineFilterSearchpath when present. - Introduce a small
PredicateLabelProvideradapter to bridge the existing&dyn Fn(&u32) -> boolfilter predicate intoQueryLabelProvider<u32>. - Add disk-provider tests covering (1) no-op equivalence vs plain
Knnand (2) selective predicates returning only matching IDs; update callers to passNoneuntil CLI/JSON exposes AdaptiveL.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| diskann-tools/src/utils/search_disk_index.rs | Passes None for the new adaptive_l argument (not yet exposed via CLI). |
| diskann-disk/src/search/provider/disk_provider.rs | Implements filter_search via InlineFilterSearch + AdaptiveL, adds adapter + tests, and extends search APIs with adaptive_l. |
| diskann-disk/src/build/builder/core.rs | Updates test call sites to include the new adaptive_l parameter. |
| diskann-benchmark/src/backend/disk_index/search.rs | Passes None for the new adaptive_l argument (not yet exposed via benchmark JSON). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
You may want to take a look at the changes that are coming to filters with #1141 and make sure your changes are compatible |
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (89.36%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1173 +/- ##
==========================================
- Coverage 89.64% 89.64% -0.01%
==========================================
Files 502 503 +1
Lines 95500 95707 +207
==========================================
+ Hits 85607 85792 +185
- Misses 9893 9915 +22
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
This looks fine to me pending a couple of things:
|
Reconciles the new DeterminantDiversity post-processor feature from main (#1141 follow-on) with this branch's SearchMode enum. Folds the post- processor selection into SearchMode as a fourth variant rather than exposing it as an orthogonal `post_processor` parameter: pub enum SearchMode<'a> { FlatScan { filter }, Graph { filter }, InlineFilter { predicate, adaptive_l }, DiverseGraph { filter, params: DeterminantDiversityParams }, // new } Net effect: public `search()` stays at a single `mode` parameter; main's `SearchPostProcessorKind` enum is removed (its variants are reachable via SearchMode constructors). The internal `DiskSearchPostProcessor` dispatch type is kept and now drives the DiverseGraph match arm via `index.search_with`. `DeterminantDiversityAndFilter.filter` migrates to `Option<PostprocessFilter>` for consistency with this branch's RerankAndFilter migration. Migrated main's `test_disk_search_determinant_diversity` to the new SearchMode API (now uses `SearchMode::diverse_graph(params)` and `SearchMode::diverse_graph_filtered(predicate, params)`). Benchmark `disk_index/search.rs` gains a 6-arm match that builds the SearchMode from the JSON-driven (is_flat_search, has_filter, post_processor) triple. Tools and builder pass `SearchMode::graph()` unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
arkrishn94
left a comment
There was a problem hiding this comment.
Thanks @dyhyfu, just left a couple of comments.
suri-kumkaran
left a comment
There was a problem hiding this comment.
We are good to go after fixing disk-index benchmark input and moving towards PostprocessConfig.
| use std::{fmt, num::NonZeroUsize, path::Path}; | ||
|
|
||
| use anyhow::Context; | ||
| #[cfg(feature = "disk-index")] |
There was a problem hiding this comment.
Any reason we have everything gated by #[cfg(feature = "disk-index")]?
This PR is to add filter search to disk path using AdpativeL filter algorithm.
Reference PR: #1131
The main changes: