pub struct LshIndex { /* private fields */ }
Implementations§
source§impl LshIndex
impl LshIndex
sourcepub fn new_with_options(
d: u32,
nbits: u32,
rotate_data: bool,
train_thresholds: bool
) -> Result<Self>
pub fn new_with_options(
d: u32,
nbits: u32,
rotate_data: bool,
train_thresholds: bool
) -> Result<Self>
Create a new LSH index.
pub fn nbits(&self) -> u32
pub fn rotate_data(&self) -> bool
pub fn train_thresholds(&self) -> bool
pub fn bytes_per_vec(&self) -> usize
Trait Implementations§
source§impl ConcurrentIndex for LshIndex
impl ConcurrentIndex for LshIndex
source§fn assign(&self, query: &[f32], k: usize) -> Result<AssignSearchResult>
fn assign(&self, query: &[f32], k: usize) -> Result<AssignSearchResult>
Similar to
search
, but only provides the labels.source§fn search(&self, query: &[f32], k: usize) -> Result<SearchResult>
fn search(&self, query: &[f32], k: usize) -> Result<SearchResult>
Perform a search for the
k
closest vectors to the given query vectors.source§fn range_search(&self, query: &[f32], radius: f32) -> Result<RangeSearchResult>
fn range_search(&self, query: &[f32], radius: f32) -> Result<RangeSearchResult>
Perform a ranged search for the vectors closest to the given query vectors
by the given radius. Read more
source§impl FromInnerPtr for LshIndex
impl FromInnerPtr for LshIndex
source§unsafe fn from_inner_ptr(inner_ptr: *mut FaissIndex) -> Self
unsafe fn from_inner_ptr(inner_ptr: *mut FaissIndex) -> Self
Create an index using the given pointer to a native object. Read more
source§impl Index for LshIndex
impl Index for LshIndex
source§fn is_trained(&self) -> bool
fn is_trained(&self) -> bool
Whether the Index does not require training, or if training is done already
source§fn metric_type(&self) -> MetricType
fn metric_type(&self) -> MetricType
The metric type assumed by the index
source§fn add(&mut self, x: &[f32]) -> Result<()>
fn add(&mut self, x: &[f32]) -> Result<()>
Add new data vectors to the index.
This assumes a C-contiguous memory slice of vectors, where the total
number of vectors is
x.len() / d
. Read moresource§fn add_with_ids(&mut self, x: &[f32], xids: &[Idx]) -> Result<()>
fn add_with_ids(&mut self, x: &[f32], xids: &[Idx]) -> Result<()>
Add new data vectors to the index with IDs.
This assumes a C-contiguous memory slice of vectors, where the total
number of vectors is
x.len() / d
.
Not all index types may support this operation. Read moresource§fn assign(&mut self, query: &[f32], k: usize) -> Result<AssignSearchResult>
fn assign(&mut self, query: &[f32], k: usize) -> Result<AssignSearchResult>
Similar to
search
, but only provides the labels.source§fn search(&mut self, query: &[f32], k: usize) -> Result<SearchResult>
fn search(&mut self, query: &[f32], k: usize) -> Result<SearchResult>
Perform a search for the
k
closest vectors to the given query vectors.source§fn range_search(
&mut self,
query: &[f32],
radius: f32
) -> Result<RangeSearchResult>
fn range_search(
&mut self,
query: &[f32],
radius: f32
) -> Result<RangeSearchResult>
Perform a ranged search for the vectors closest to the given query vectors
by the given radius. Read more
source§fn remove_ids(&mut self, sel: &IdSelector) -> Result<i64>
fn remove_ids(&mut self, sel: &IdSelector) -> Result<i64>
Remove data vectors represented by IDs.
source§impl NativeIndex for LshIndex
impl NativeIndex for LshIndex
source§fn inner_ptr(&self) -> *mut FaissIndex
fn inner_ptr(&self) -> *mut FaissIndex
Retrieve a pointer to the native index object.