pub struct LinearScanIndex { /* private fields */ }Expand description
Linear scan index for comparison (exact search)
Implementations§
Source§impl LinearScanIndex
impl LinearScanIndex
Sourcepub fn new(config: TurboQuantConfig) -> Result<Self>
pub fn new(config: TurboQuantConfig) -> Result<Self>
Create a new linear scan 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 using exact cosine similarity
Sourcepub fn stats(&self) -> LinearScanStats
pub fn stats(&self) -> LinearScanStats
Get index statistics
Auto Trait Implementations§
impl Freeze for LinearScanIndex
impl RefUnwindSafe for LinearScanIndex
impl Send for LinearScanIndex
impl Sync for LinearScanIndex
impl Unpin for LinearScanIndex
impl UnsafeUnpin for LinearScanIndex
impl UnwindSafe for LinearScanIndex
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<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.