Skip to content

fix: honor radius/linear/refiner set before set*Params() (closes #197) - #198

Merged
s2x merged 2 commits into
mainfrom
fix/issue-197-query-params-order
Aug 8, 2026
Merged

fix: honor radius/linear/refiner set before set*Params() (closes #197)#198
s2x merged 2 commits into
mainfrom
fix/issue-197-query-params-order

Conversation

@s2x

@s2x s2x commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #197

Calling setRadius(), setLinear() or setUsingRefiner() on a ZVecVectorQuery before any set*Params() method silently dropped those settings — param setters replaced query_params_ wholesale, so queries ran with wrong settings (e.g. radius 0.0) with no error. Affected HNSW, IVF, Vamana, RaBitQ and Flat indexes.

Changes

  • ffi/zvec_ffi.cc: new merge_stored_query_settings() helper applied after each of the 5 param setters (set_hnsw_ef, set_hnsw_rabitq_ef, set_vamana_ef_search, set_ivf_nprobe, set_flat_mode) — stored radius/linear/refiner values are merged into the freshly created params, so setter order no longer matters. Unconditional merge is a no-op when nothing was pre-set (constructor defaults 0.0f/false/false).
  • tests/test_query_params_order.phpt: regression test (Flat + HNSW, L2) verifying radius/linear/refiner-before-params behave identically to params-first. Verified to FAIL pre-fix and PASS post-fix.
  • CHANGELOG.md: Fixed entry.

Testing

  • Builds locally (FFI libzvec_ffi.dylib rebuilt on Darwin)
  • All .phpt tests pass: 181 tests — 177 passed, 2 skipped (RaBitQ Linux-only etc.), 2 expected-fail, 0 failed
  • No test database leftovers (test_dbs/ empty)

Code Review

  • Passed subagent code review (no correctness issues; CHANGELOG gap addressed)
  • All review comments addressed

@s2x s2x self-assigned this Aug 8, 2026
@s2x
s2x merged commit 8ed8fe4 into main Aug 8, 2026
3 checks passed
@s2x
s2x deleted the fix/issue-197-query-params-order branch August 8, 2026 17:28
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.

queryVector(): setRadius()/setLinear()/setUsingRefiner() called before set*Params() are silently dropped

1 participant