pub struct NgtIndex<T> { /* private fields */ }
Implementations§
source§impl<T> NgtIndex<T>where
T: NgtObjectType,
impl<T> NgtIndex<T>where T: NgtObjectType,
sourcepub fn create<P: AsRef<Path>>(path: P, prop: NgtProperties<T>) -> Result<Self>
pub fn create<P: AsRef<Path>>(path: P, prop: NgtProperties<T>) -> Result<Self>
Creates an empty ANNG index with the given NgtProperties
.
sourcepub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self>
Open the already existing index at the specified path.
sourcepub fn search(
&self,
vec: &[T],
res_size: usize,
epsilon: f32
) -> Result<Vec<SearchResult>>
pub fn search( &self, vec: &[T], res_size: usize, epsilon: f32 ) -> Result<Vec<SearchResult>>
Search the nearest vectors to the specified query vector.
The index must have been built
beforehand.
sourcepub fn search_query(&self, query: NgtQuery<'_, T>) -> Result<Vec<SearchResult>>
pub fn search_query(&self, query: NgtQuery<'_, T>) -> Result<Vec<SearchResult>>
sourcepub fn insert(&mut self, vec: Vec<T>) -> Result<VecId>
pub fn insert(&mut self, vec: Vec<T>) -> Result<VecId>
Insert the specified vector into the index. However note that it is not discoverable yet.
The method build
must be called after inserting vectors.
sourcepub fn insert_batch(&mut self, batch: Vec<Vec<T>>) -> Result<()>
pub fn insert_batch(&mut self, batch: Vec<Vec<T>>) -> Result<()>
Insert the multiple vectors into the index. However note that they are not discoverable yet.
The method build
must be called after inserting vectors.
sourcepub fn build(&mut self, num_threads: usize) -> Result<()>
pub fn build(&mut self, num_threads: usize) -> Result<()>
Build the index for the vectors that have been inserted so far.
sourcepub fn nb_inserted(&self) -> usize
pub fn nb_inserted(&self) -> usize
The number of vectors inserted (but not necessarily indexed).
sourcepub fn nb_indexed(&self) -> usize
pub fn nb_indexed(&self) -> usize
The number of indexed vectors, available after build
.
Trait Implementations§
impl<T> Send for NgtIndex<T>
impl<T> Sync for NgtIndex<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for NgtIndex<T>where T: RefUnwindSafe,
impl<T> Unpin for NgtIndex<T>where T: Unpin,
impl<T> UnwindSafe for NgtIndex<T>where T: UnwindSafe,
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