Skip to content

Add algorithm and benchmark for filtered range search#1228

Open
magdalendobson wants to merge 41 commits into
mainfrom
users/magdalen/range_filter
Open

Add algorithm and benchmark for filtered range search#1228
magdalendobson wants to merge 41 commits into
mainfrom
users/magdalen/range_filter

Conversation

@magdalendobson

@magdalendobson magdalendobson commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This PR adds an algorithm for filtered range search to the DiskANN repository. Details of the algorithm, along with the experiments supporting it, are at this Wiki page.

This PR:

  1. Adds the new algorithm to diskann, along with integration tests.
  2. Adds the new algorithm as an option in diskann-benchmark, along with an integration test.
  3. Adds filtered range groundtruth files in test_data.

Some enhancements/fixes to range search along the way:

  1. Added range groundtruth in test_data for yfcc.
  2. Fixed a bug where range search was not always honoring the maximum number of returned results.
  3. Added integration tests for range search making sure a set maximum number of results is actually respected.

Magdalen Manohar and others added 30 commits May 14, 2026 17:56
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@magdalendobson magdalendobson marked this pull request as ready for review July 6, 2026 19:13
@magdalendobson magdalendobson requested review from a team and Copilot July 6, 2026 19:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces filtered range search into the diskann search stack and wires it into diskann-benchmark, along with new groundtruth artifacts and integration tests. It also tightens unfiltered range-search behavior to better respect max_returned and adds regression tests to prevent future violations.

Changes:

  • Added FilteredRange search type to diskann (new implementation + exports) and created dedicated integration tests/baselines.
  • Extended diskann-benchmark / diskann-benchmark-core to accept a new "filtered-range" search phase and run end-to-end integration tests.
  • Added new (LFS-backed) range-search groundtruth files and test inputs.

Reviewed changes

Copilot reviewed 22 out of 32 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test_data/yfcc/groundtruth_rad_75000.rangeres Adds YFCC range-search groundtruth pointer (LFS).
test_data/yfcc/groundtruth_rad_110000_filtered.rangeres Adds YFCC filtered-range groundtruth pointer (LFS).
test_data/disk_index_search/groundtruth_rad_125000_filtered.rangeres Adds filtered-range groundtruth pointer (LFS) for benchmark integration test data.
diskann/test/generated/graph/test/cases/range_search/max_results_respected_means_no_second_round.json New baseline for range-search max_returned behavior.
diskann/test/generated/graph/test/cases/range_search/max_results_respected_and_second_round_triggered.json New baseline for second-round triggering when max_returned allows it.
diskann/test/generated/graph/test/cases/filtered_range_search/two_round_search.json New filtered-range baseline.
diskann/test/generated/graph/test/cases/filtered_range_search/max_results_respected_means_no_second_round.json New filtered-range baseline.
diskann/test/generated/graph/test/cases/filtered_range_search/max_results_respected_and_second_round_triggered.json New filtered-range baseline.
diskann/test/generated/graph/test/cases/filtered_range_search/inner_radius_filtering.json New filtered-range baseline for inner radius behavior.
diskann/test/generated/graph/test/cases/filtered_range_search/divisible_by_four_filter_second_round_triggered.json New filtered-range baseline for selective filter + second round.
diskann/test/generated/graph/test/cases/filtered_range_search/divisible_by_four_filter_no_second_round_from_max_results.json New filtered-range baseline for selective filter + max_returned interaction.
diskann/test/generated/graph/test/cases/filtered_range_search/divisible_by_four_filter_no_second_round_from_l_search.json New filtered-range baseline for selective filter + larger starting_l.
diskann/test/generated/graph/test/cases/filtered_range_search/basic_range_search.json New filtered-range baseline for basic search.
diskann/src/graph/test/cases/range_search.rs Exposes shared helpers/baseline struct and adds new max_returned regression tests.
diskann/src/graph/test/cases/mod.rs Registers new filtered-range test module.
diskann/src/graph/test/cases/filtered_range_search.rs Adds integration tests and baselines for filtered range search.
diskann/src/graph/search/range_search.rs Ensures second round + frontier expansion honor max_returned.
diskann/src/graph/search/mod.rs Adds filtered-range module and re-exports FilteredRange.
diskann/src/graph/search/inline_filter_search.rs Makes internal return type/function pub(crate) for reuse by filtered-range search.
diskann/src/graph/search/filtered_range_search.rs Implements the new FilteredRange search type and its internal second-round expansion.
diskann/src/graph/glue.rs Adds PartialEq/Eq derives for Decision<T>.
diskann-benchmark/src/main.rs Adds benchmark integration tests for range and filtered-range JSON examples.
diskann-benchmark/src/inputs/graph_index.rs Adds "filtered-range" search phase schema + validation.
diskann-benchmark/src/index/search/range.rs Generalizes range runner to support both range and filtered-range backends via parameter mapping.
diskann-benchmark/src/index/search/plugins.rs Adds filtered-range plugin entry.
diskann-benchmark/src/index/result.rs Adds RangeSearchResults::new_filtered constructor for filtered-range summaries.
diskann-benchmark/src/index/inmem/spherical.rs Wires filtered-range plugin into spherical in-mem benchmark path.
diskann-benchmark/src/index/benchmarks.rs Wires filtered-range plugin into benchmark registry + job runner.
diskann-benchmark/example/graph-index-filter-range.json Adds example job config for "filtered-range".
diskann-benchmark-core/src/search/mod.rs Documents filtered-range support.
diskann-benchmark-core/src/search/graph/mod.rs Exposes new filtered_range module.
diskann-benchmark-core/src/search/graph/filtered_range.rs Adds benchmark-core searcher + aggregation plumbing for filtered-range.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +215 to +219
InternalSearchStats {
cmps,
hops: hops + range_stats.hops,
range_search_second_round: true,
},
Comment thread diskann/src/graph/search/filtered_range_search.rs Outdated
Comment on lines +6 to +9
//! Tests for filtered range search using an always-true filter.
//!
//! These cover the filtered-range cases directly and validate the filtered-range
//! behavior against its own baselines.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@magdalendobson magdalendobson linked an issue Jul 7, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support filtered range search

3 participants