feat: expose approx_mode on vector queries

`ApproxMode` landed in the Rust core in #3549, but the Python and Node.js bindings were never plumbed, so `approx_mode` is unreachable from either SDK. Both were built mirroring the existing `ef` plumbing.

Co-authored-by: Leo <leo@insight.co>
This commit is contained in:
Leo
2026-11-03 12:45:52 +08:00
committed by GitHub
co-authored by Leo
parent f9389f113e
commit f2bcb156ad
13 changed files with 326 additions and 12 deletions
+8
View File
@@ -15,6 +15,7 @@ use arrow_array::{
};
use arrow_buffer::ScalarBuffer;
use half::f16;
use lancedb::ApproxMode;
use lancedb::index::scalar::{
BooleanQuery, BoostQuery, FtsQuery, FullTextSearchQuery, MatchQuery, MultiMatchQuery, Occur,
Operator, PhraseQuery,
@@ -352,6 +353,13 @@ impl VectorQuery {
self.inner = self.inner.clone().ef(ef as usize);
}
#[napi]
pub fn approx_mode(&mut self, approx_mode: String) -> napi::Result<()> {
let approx_mode = ApproxMode::try_from(approx_mode.as_str()).default_error()?;
self.inner = self.inner.clone().approx_mode(approx_mode);
Ok(())
}
#[napi]
pub fn bypass_vector_index(&mut self) {
self.inner = self.inner.clone().bypass_vector_index()