pub trait ConcurrentIndex: Index {
    // Required methods
    fn assign(&self, q: &[f32], k: usize) -> Result<AssignSearchResult>;
    fn search(&self, q: &[f32], k: usize) -> Result<SearchResult>;
    fn range_search(&self, q: &[f32], radius: f32) -> Result<RangeSearchResult>;
}
Expand description

Trait for a Faiss index that can be safely searched over multiple threads. Operations which do not modify the index are given a method taking an immutable reference. This is not the default for every index type because some implementations (such as the ones running on the GPU) do not allow concurrent searches.

Users of these methods should still note that batched querying is considerably faster than running queries one by one, even in parallel.

Required Methods§

source

fn assign(&self, q: &[f32], k: usize) -> Result<AssignSearchResult>

Similar to search, but only provides the labels.

source

fn search(&self, q: &[f32], k: usize) -> Result<SearchResult>

Perform a search for the k closest vectors to the given query vectors.

Perform a ranged search for the vectors closest to the given query vectors by the given radius.

Implementations on Foreign Types§

source§

impl<CI: ConcurrentIndex> ConcurrentIndex for Box<CI>

source§

fn assign(&self, q: &[f32], k: usize) -> Result<AssignSearchResult>

source§

fn search(&self, q: &[f32], k: usize) -> Result<SearchResult>

Implementors§