feat: fast_search in Python and Node (#1623)

Sometimes it is acceptable to users to only search indexed data and skip
and new un-indexed data. For example, if un-indexed data will be shortly
indexed and they don't mind the delay. In these cases, we can save a lot
of CPU time in search, and provide better latency. Users can activate
this on queries using `fast_search()`.
This commit is contained in:
Will Jones
2024-11-01 09:29:09 -07:00
committed by GitHub
parent f3fc339ef6
commit 96181ab421
6 changed files with 86 additions and 0 deletions

View File

@@ -68,6 +68,10 @@ impl Query {
self.inner = self.inner.clone().offset(offset as usize);
}
pub fn fast_search(&mut self) {
self.inner = self.inner.clone().fast_search();
}
pub fn nearest_to(&mut self, vector: Bound<'_, PyAny>) -> PyResult<VectorQuery> {
let data: ArrayData = ArrayData::from_pyarrow_bound(&vector)?;
let array = make_array(data);
@@ -146,6 +150,10 @@ impl VectorQuery {
self.inner = self.inner.clone().offset(offset as usize);
}
pub fn fast_search(&mut self) {
self.inner = self.inner.clone().fast_search();
}
pub fn column(&mut self, column: String) {
self.inner = self.inner.clone().column(&column);
}