feat: add range search across language bindings - #110
Conversation
The range oracle tests use fminf/fmaxf, which require an explicit libm dependency when linking on Linux. Link the C test executable against m on UNIX without changing the binding or core behavior. Validated with CMake, -Wall -Wextra -Werror, all C tests including 168 core oracle cases, cargo fmt, and the ASF header check. Linux validation follows in PR CI.
Add indexed Java result access, bound JNI metadata staging, and cover memory and ownership regressions.
| return labels[hitIndex]; | ||
| } | ||
|
|
||
| public float[] distances() { |
There was a problem hiding this comment.
[Major] Make raw distance semantics explicit across bindings
fromEndpoints accepts public-space values, but range results expose core values as plain distances (L2 is squared and inner product is negated). A caller that compares a returned value with the original endpoint therefore gets the wrong answer. Please apply one explicit contract across Rust, C, C++, Java, and Python: name result values rawDistances/raw_distances (including indexed accessors), and make raw-band constructors internal or explicitly raw-named so the public construction path is fromEndpoints.
There was a problem hiding this comment.
Thanks, fixed in 3cdd045. Unified raw_distances/rawDistances (including indexed/query access) across all five languages, with explicit raw constructors and public endpoint factories. Added API-contract/endpoint regressions and updated docs; numeric values and zero-copy behavior are unchanged.
Use raw-distance names across Rust, C, C++, Java, and Python, including indexed and per-query access. Make raw band construction explicit and keep public endpoint conversion as the normal entry point. Document the range API migration and add contract, endpoint, ABI-layout, and zero-copy regressions. Preserve result values, ownership, C ABI layout, and existing top-K APIs.
Summary
Expose the core range-search functionality from #108 through the existing C ABI/generated header, C++, JNI/Java, and Python bindings.
Tests and documentation
Validation
Validated locally on macOS:
cargo fmt --all -- --checkcargo clippy --all-targets --workspace -- -D warningscargo test --workspace: 676 passed, 2 ignored-Wall -Wextra -Werror), existing and new binding tests, and ASan/UBSan runs: passed; 168 oracle cases per binding-Xcheck:jni: passed; 168 oracle casesPVI_RANGE_FIXTURESenabled: 497 passed, including 168 oracle casesgit diff --check: passedIndependent pre-PR reviews were completed; the older-native-library and unaligned-input findings were fixed and re-reviewed. C++/JNI allocation-failure paths were reviewed but are not exhaustively fault-injected. Cross-platform CI remains to run on this PR.
Scope and compatibility
Based on main at
0e25175(#108). No core source/tests, storage-format, algorithm, or performance-tuning changes are included. DiskANN remains unsupported for range search. No data migration is required; rollback is a revert of this PR.