Skip to content

MOD-13176 Add Ad-Hoc Brute Force Context API for disk-based vector search#917

Merged
meiravgri merged 8 commits intomainfrom
meiravg_adhoc_bf_test
Mar 18, 2026
Merged

MOD-13176 Add Ad-Hoc Brute Force Context API for disk-based vector search#917
meiravgri merged 8 commits intomainfrom
meiravg_adhoc_bf_test

Conversation

@meiravgri
Copy link
Collaborator

@meiravgri meiravgri commented Mar 17, 2026

Overview

Introduces a new VecSimAdhocBfCtx abstraction 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

  • New VecSimAdhocBfCtx class inheriting from VecsimBaseObject
  • New C API entrypoints:
    • VecSimIndex_AdhocBfCtx_New() - Create context for a query vector
    • VecSimIndex_AdhocBfCtx_Free() - Release context
    • VecSimIndex_AdhocBfCtx_GetDistanceFrom() - Get distance for a single label
    • VecSimIndex_AdhocBfCtx_GetExactDistances() - Batch-fetch exact distances for reranking
  • New virtual method VecSimIndexInterface::newAdhocBfCtx() (defaults to nullptr for unsupported index types)
  • Compile-time static_assert to enforce labelType == size_t at C/C++ boundary

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

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 method VecSimIndexInterface::newAdhocBfCtx (defaulting to nullptr for unsupported index types). Also adds a compile-time static_assert to enforce labelType == size_t at the C/C++ boundary.

Written by Cursor Bugbot for commit 96b659e. This will update automatically on new commits. Configure here.

@jit-ci
Copy link

jit-ci bot commented Mar 17, 2026

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.01%. Comparing base (8d37cf1) to head (96b659e).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/VecSim/vec_sim.cpp 0.00% 9 Missing ⚠️
src/VecSim/vec_sim_interface.h 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@meiravgri meiravgri changed the title Meiravg_adhoc_bf_test MOD-13176 Add Ad-Hoc Brute Force Context API for disk-based vector search Mar 17, 2026
@meiravgri meiravgri requested a review from GuyAv46 March 17, 2026 16:46
@meiravgri meiravgri added this pull request to the merge queue Mar 18, 2026
Merged via the queue into main with commit 3dd2dc2 Mar 18, 2026
16 of 17 checks passed
@meiravgri meiravgri deleted the meiravg_adhoc_bf_test branch March 18, 2026 09:25
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.

2 participants