pub struct TurboQuantIndex { /* private fields */ }Expand description
TurboQuant index for fast approximate nearest neighbor search
Implementations§
Source§impl TurboQuantIndex
impl TurboQuantIndex
Sourcepub fn new(config: TurboQuantConfig) -> Result<Self>
pub fn new(config: TurboQuantConfig) -> Result<Self>
Create a new TurboQuant index
Sourcepub fn add_vector(&mut self, entity_id: i64, vector: &[f32]) -> Result<()>
pub fn add_vector(&mut self, entity_id: i64, vector: &[f32]) -> Result<()>
Add a vector to the index
Sourcepub fn search(&self, query: &[f32], k: usize) -> Result<Vec<(i64, f32)>>
pub fn search(&self, query: &[f32], k: usize) -> Result<Vec<(i64, f32)>>
Search for k nearest neighbors
Sourcepub fn add_vectors_batch(&mut self, vectors: &[(i64, Vec<f32>)]) -> Result<()>
pub fn add_vectors_batch(&mut self, vectors: &[(i64, Vec<f32>)]) -> Result<()>
Batch add vectors to the index
Sourcepub fn stats(&self) -> TurboQuantStats
pub fn stats(&self) -> TurboQuantStats
Get index statistics
Sourcepub fn remove_vector(&mut self, entity_id: i64) -> Result<()>
pub fn remove_vector(&mut self, entity_id: i64) -> Result<()>
Remove a vector from the index
Sourcepub fn config(&self) -> &TurboQuantConfig
pub fn config(&self) -> &TurboQuantConfig
Get the config
Trait Implementations§
Source§impl Clone for TurboQuantIndex
impl Clone for TurboQuantIndex
Source§fn clone(&self) -> TurboQuantIndex
fn clone(&self) -> TurboQuantIndex
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TurboQuantIndex
impl Debug for TurboQuantIndex
Source§impl<'de> Deserialize<'de> for TurboQuantIndex
impl<'de> Deserialize<'de> for TurboQuantIndex
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TurboQuantIndex
impl RefUnwindSafe for TurboQuantIndex
impl Send for TurboQuantIndex
impl Sync for TurboQuantIndex
impl Unpin for TurboQuantIndex
impl UnsafeUnpin for TurboQuantIndex
impl UnwindSafe for TurboQuantIndex
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.