MOD-13176 Add Ad-Hoc Brute Force Context API for disk-based vector search#917
Merged
MOD-13176 Add Ad-Hoc Brute Force Context API for disk-based vector search#917
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #917 +/- ##
==========================================
- Coverage 97.14% 97.01% -0.13%
==========================================
Files 129 129
Lines 7557 7567 +10
==========================================
Hits 7341 7341
- Misses 216 226 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
GuyAv46
approved these changes
Mar 18, 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.

Overview
Introduces a new
VecSimAdhocBfCtxabstraction to preprocess a query vector once and reuse it for repeated distance computations. This is the foundation for efficient hybrid ad-hoc brute force search on disk-based HNSW indexes.Changes
VecSimAdhocBfCtxclass inheriting fromVecsimBaseObjectVecSimIndex_AdhocBfCtx_New()- Create context for a query vectorVecSimIndex_AdhocBfCtx_Free()- Release contextVecSimIndex_AdhocBfCtx_GetDistanceFrom()- Get distance for a single labelVecSimIndex_AdhocBfCtx_GetExactDistances()- Batch-fetch exact distances for rerankingVecSimIndexInterface::newAdhocBfCtx()(defaults tonullptrfor unsupported index types)static_assertto enforcelabelType == size_tat C/C++ boundaryMark if applicable
Note
Medium Risk
Introduces a new public C API and virtual extension point for creating/freeing query contexts and computing distances, which can impact ABI/API consumers and allocator/lifetime handling if misused.
Overview
Adds a new ad-hoc brute force context abstraction (
VecSimAdhocBfCtx) to preprocess a query once and reuse it for repeated distance computations (including a batched exact-distance path).Exposes this via new C API entrypoints (
VecSimIndex_AdhocBfCtx_New/Free/GetDistanceFrom/GetExactDistances) that delegate to a new virtual methodVecSimIndexInterface::newAdhocBfCtx(defaulting tonullptrfor unsupported index types). Also adds a compile-timestatic_assertto enforcelabelType == size_tat the C/C++ boundary.Written by Cursor Bugbot for commit 96b659e. This will update automatically on new commits. Configure here.