pub struct TurboTable { /* private fields */ }Expand description
Approximate-nearest-neighbour table backed by
turbovec::TurboQuantIndex.
Implementations§
Source§impl TurboTable
impl TurboTable
Sourcepub fn new(distance: Distance, dim: u16, bits: u8) -> Result<Self, IndexError>
pub fn new(distance: Distance, dim: u16, bits: u8) -> Result<Self, IndexError>
Build an empty turbovec-backed table.
§Errors
IndexError::Empty when dim == 0, or when bits is
not in {2, 3, 4}. IndexError::DimensionMismatch
when dim is not a positive multiple of 8 (turbovec’s
only dimensional constraint); the expected field is
rounded up to the next multiple of 8 to give the caller
a workable suggestion.
Sourcepub fn insert(&mut self, id: NodeId, vector: Vec<f32>) -> Result<(), IndexError>
pub fn insert(&mut self, id: NodeId, vector: Vec<f32>) -> Result<(), IndexError>
Insert a vector under id.
vector is taken in the application’s f32 form; the
turbovec encode pipeline handles rotation, calibration
and packing. When the table’s metric is Cosine or
Euclidean the vector is L2-normalised before being
added, so turbovec’s inner-product surrogate doubles as
a cosine estimate.
§Errors
IndexError::Empty for a zero-dim vector,
IndexError::DimensionMismatch when the vector’s
dimension differs from the table’s frozen dim, and
IndexError::Duplicate when id is already present.
Sourcepub fn delete(&mut self, id: NodeId) -> bool
pub fn delete(&mut self, id: NodeId) -> bool
Soft-delete the vector at id. The slot stays in the
turbovec index for positional integrity but is filtered
out of search results via the bool mask.
Returns true when the id was present, false
otherwise.
Sourcepub fn search(
&self,
query: &[f32],
k: usize,
_ef: Option<usize>,
) -> Result<Vec<SearchResult>, IndexError>
pub fn search( &self, query: &[f32], k: usize, _ef: Option<usize>, ) -> Result<Vec<SearchResult>, IndexError>
Search for the k nearest neighbours of query. The
_ef argument is accepted for HNSW API parity and
ignored; turbovec scans every block and does not expose
a beam-width knob.
§Errors
IndexError::DimensionMismatch when the query
dimension does not match the table’s frozen dim.
Auto Trait Implementations§
impl !Freeze for TurboTable
impl RefUnwindSafe for TurboTable
impl Send for TurboTable
impl Sync for TurboTable
impl Unpin for TurboTable
impl UnsafeUnpin for TurboTable
impl UnwindSafe for TurboTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.