Skip to content

Commit b0d5929

Browse files
committed
fix(svs_flat): accept all-clear bitset as unfiltered search
Before: any non-empty BitsetView passed to SvsFlatIndexNode::Search() caused an immediate `not_implemented` return, even when every bit was zero (i.e. no vectors filtered out). Callers that pre-allocate a bitset for shape consistency -- e.g. the vecTool nightly harness always passes a bitset whose size matches the base set but leaves it all-clear for plain kNN -- would see every SVS_FLAT search fail at the first query. After: reject only when the bitset is both non-empty AND has at least one bit set. All-clear bitsets fall through to the non-bitset search path, which is the correct semantic for "no filtering requested". `BitsetView::count()` (include/knowhere/bitsetview.h:50) returns the number of filtered-out bits / ids, so the added `&& bitset.count() > 0` is cheap and doesn't scan the bitmap. Also register raw `SVS_VAMANA` in the SVS registration block so the factory can construct it, matching the existing `Type()` implementation and the LVQ / LeanVec registrations in the same file. No regression on the actual-filter case: when the caller does have bits set, we still surface the same not_implemented error with the same message string, matching the current behavior. Fixes one of the class of failures seen when running the vecTool newNightly L2 SVS smoke benchmark (all 6 SVS_FLAT groups across cohere_1m + qwen3vl_200k x {fp32, fp16, bf16} previously failed identically at search stage; HNSW siblings on the same group IDs passed). See zilliztech/vecTool#21 for the upstream discussion. Signed-off-by: jamesgao-jpg <james.gao@zilliz.com>
1 parent 6f4de3b commit b0d5929

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/index/svs/svs_flat.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class SvsFlatIndexNode : public IndexNode {
7676
return expected<DataSetPtr>::Err(Status::empty_index, "index not loaded");
7777
}
7878

79-
if (!bitset.empty()) {
79+
if (!bitset.empty() && bitset.count() > 0) {
8080
return expected<DataSetPtr>::Err(Status::not_implemented, "SVS Flat does not support bitset filtering");
8181
}
8282

src/index/svs/svs_vamana.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,8 @@ class SvsVamanaLeanVecIndexNode : public SvsVamanaIndexNode<DataType> {
519519

520520
// temporarily removed `MMAP` until it's fully honored by SVS
521521

522+
KNOWHERE_MOCK_REGISTER_DENSE_FLOAT_ALL_GLOBAL(SVS_VAMANA, SvsVamanaIndexNode, knowhere::feature::NONE)
523+
522524
KNOWHERE_MOCK_REGISTER_DENSE_FLOAT_ALL_GLOBAL(SVS_VAMANA_LVQ, SvsVamanaLvqIndexNode, knowhere::feature::NONE)
523525

524526
KNOWHERE_MOCK_REGISTER_DENSE_FLOAT_ALL_GLOBAL(SVS_VAMANA_LEANVEC, SvsVamanaLeanVecIndexNode, knowhere::feature::NONE)

0 commit comments

Comments
 (0)