feat: support distance range in queries (#1999)

this also updates the docs

---------

Signed-off-by: BubbleCal <bubble-cal@outlook.com>
This commit is contained in:
BubbleCal
2025-01-08 11:03:27 +08:00
committed by GitHub
parent 0e496ed3b5
commit 3c0a64be8f
8 changed files with 337 additions and 3 deletions

View File

@@ -171,6 +171,15 @@ impl VectorQuery {
self.inner = self.inner.clone().nprobes(nprobe as usize);
}
#[napi]
pub fn distance_range(&mut self, lower_bound: Option<f64>, upper_bound: Option<f64>) {
// napi doesn't support f32, so we have to convert to f32
self.inner = self
.inner
.clone()
.distance_range(lower_bound.map(|v| v as f32), upper_bound.map(|v| v as f32));
}
#[napi]
pub fn ef(&mut self, ef: u32) {
self.inner = self.inner.clone().ef(ef as usize);