Trait faiss::index::ConcurrentIndex
source · 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§
sourcefn assign(&self, q: &[f32], k: usize) -> Result<AssignSearchResult>
fn assign(&self, q: &[f32], k: usize) -> Result<AssignSearchResult>
Similar to search
, but only provides the labels.
sourcefn search(&self, q: &[f32], k: usize) -> Result<SearchResult>
fn search(&self, q: &[f32], k: usize) -> Result<SearchResult>
Perform a search for the k
closest vectors to the given query vectors.
sourcefn range_search(&self, q: &[f32], radius: f32) -> Result<RangeSearchResult>
fn range_search(&self, q: &[f32], radius: f32) -> Result<RangeSearchResult>
Perform a ranged search for the vectors closest to the given query vectors by the given radius.