Skip to main content

VectorIndex

Trait VectorIndex 

Source
pub trait VectorIndex: Send + Sync {
    // Required methods
    fn kind(&self) -> VectorIndexKind;
    fn rows(&self) -> usize;
    fn search(
        &self,
        query: &[f32],
        k: usize,
        ef: usize,
    ) -> Result<Vec<(u32, f32)>>;
}
Expand description

A nearest-neighbour index over the rows of one VectorSnapshot.

Required Methods§

Source

fn kind(&self) -> VectorIndexKind

Source

fn rows(&self) -> usize

Source

fn search(&self, query: &[f32], k: usize, ef: usize) -> Result<Vec<(u32, f32)>>

The k best rows by cosine, best first, as (row, score); ef is the beam of an approximate index and ignored by an exact one. query is l2-normalised and has the snapshot’s dimensions.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§