[][src]Struct ngt::Index

pub struct Index { /* fields omitted */ }

Implementations

impl Index[src]

pub fn create<P: AsRef<Path>>(path: P, prop: Properties) -> Result<Self, Error>[src]

Create an empty index with the given properies.

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, Error>[src]

Open the already existing index at the specified path.

pub fn search(
    &self,
    vec: &[f64],
    res_size: u64,
    epsilon: f32
) -> Result<Vec<SearchResult>, Error>
[src]

Search the nearest vectors to the specified query vector. The index must have been built beforehand.

pub fn insert<F: Into<f64>>(&mut self, vec: Vec<F>) -> Result<VecId, Error>[src]

Insert the specified vector into the index. However note that it is not discoverable yet. The method build must be called after inserting vectors.

pub fn insert_batch<F: Into<f64>>(
    &mut self,
    batch: Vec<Vec<F>>
) -> Result<(), Error>
[src]

Insert the multiple vectors into the index. However note that they are not discoverable yet. The method build must be called after inserting vectors.

pub fn build(&mut self, num_threads: u32) -> Result<(), Error>[src]

Build the index for the vectors that have been inserted so far.

pub fn persist(&mut self) -> Result<(), Error>[src]

Persist the index to the disk.

pub fn remove(&mut self, id: VecId) -> Result<(), Error>[src]

Remove the specified vector.

pub fn get_vec(&self, id: VecId) -> Result<Vec<f32>, Error>[src]

Get the specified vector.

Trait Implementations

impl Debug for Index[src]

impl Drop for Index[src]

impl Send for Index[src]

impl Sync for Index[src]

Auto Trait Implementations

impl RefUnwindSafe for Index

impl Unpin for Index

impl UnwindSafe for Index

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.