pub struct IncrementalDiskANN<D>{ /* private fields */ }Expand description
An incremental DiskANN index supporting add/delete without full rebuild
Implementations§
Source§impl<D> IncrementalDiskANN<D>
impl<D> IncrementalDiskANN<D>
Sourcepub fn build_default(
vectors: &[Vec<f32>],
file_path: &str,
) -> Result<Self, DiskAnnError>
pub fn build_default( vectors: &[Vec<f32>], file_path: &str, ) -> Result<Self, DiskAnnError>
Build a new incremental index with default parameters
Sourcepub fn open(path: &str) -> Result<Self, DiskAnnError>
pub fn open(path: &str) -> Result<Self, DiskAnnError>
Open an existing index for incremental updates
Source§impl<D> IncrementalDiskANN<D>
impl<D> IncrementalDiskANN<D>
Sourcepub fn build_with_config(
vectors: &[Vec<f32>],
file_path: &str,
config: IncrementalConfig,
) -> Result<Self, DiskAnnError>where
D: Default,
pub fn build_with_config(
vectors: &[Vec<f32>],
file_path: &str,
config: IncrementalConfig,
) -> Result<Self, DiskAnnError>where
D: Default,
Build a new incremental index with custom configuration
Sourcepub fn open_with_config(
path: &str,
config: IncrementalConfig,
) -> Result<Self, DiskAnnError>where
D: Default,
pub fn open_with_config(
path: &str,
config: IncrementalConfig,
) -> Result<Self, DiskAnnError>where
D: Default,
Open an existing index with custom configuration
Sourcepub fn new_empty(dim: usize, dist: D, config: IncrementalConfig) -> Self
pub fn new_empty(dim: usize, dist: D, config: IncrementalConfig) -> Self
Create an empty incremental index (no base, delta-only)
Sourcepub fn add_vectors(
&self,
vectors: &[Vec<f32>],
) -> Result<Vec<u64>, DiskAnnError>
pub fn add_vectors( &self, vectors: &[Vec<f32>], ) -> Result<Vec<u64>, DiskAnnError>
Add new vectors to the index. Returns their assigned IDs.
Sourcepub fn delete_vectors(&self, ids: &[u64]) -> Result<(), DiskAnnError>
pub fn delete_vectors(&self, ids: &[u64]) -> Result<(), DiskAnnError>
Delete vectors by their IDs (lazy deletion via tombstones)
Sourcepub fn is_deleted(&self, id: u64) -> bool
pub fn is_deleted(&self, id: u64) -> bool
Check if a vector ID has been deleted
Sourcepub fn search(&self, query: &[f32], k: usize, beam_width: usize) -> Vec<u64>
pub fn search(&self, query: &[f32], k: usize, beam_width: usize) -> Vec<u64>
Search the index, merging results from base and delta, excluding tombstones
Sourcepub fn search_with_dists(
&self,
query: &[f32],
k: usize,
beam_width: usize,
) -> Vec<(u64, f32)>
pub fn search_with_dists( &self, query: &[f32], k: usize, beam_width: usize, ) -> Vec<(u64, f32)>
Search returning (id, distance) pairs
Sourcepub fn search_batch(
&self,
queries: &[Vec<f32>],
k: usize,
beam_width: usize,
) -> Vec<Vec<u64>>
pub fn search_batch( &self, queries: &[Vec<f32>], k: usize, beam_width: usize, ) -> Vec<Vec<u64>>
Parallel batch search
Sourcepub fn get_vector(&self, id: u64) -> Option<Vec<f32>>
pub fn get_vector(&self, id: u64) -> Option<Vec<f32>>
Get a vector by its ID (works for both base and delta)
Sourcepub fn should_compact(&self) -> bool
pub fn should_compact(&self) -> bool
Check if compaction is recommended
Sourcepub fn compact(&mut self, new_path: &str) -> Result<(), DiskAnnError>where
D: Default,
pub fn compact(&mut self, new_path: &str) -> Result<(), DiskAnnError>where
D: Default,
Compact the index: merge base + delta, remove tombstones, write new file
Sourcepub fn stats(&self) -> IncrementalStats
pub fn stats(&self) -> IncrementalStats
Get statistics about the index
Auto Trait Implementations§
impl<D> !Freeze for IncrementalDiskANN<D>
impl<D> RefUnwindSafe for IncrementalDiskANN<D>where
D: RefUnwindSafe,
impl<D> Send for IncrementalDiskANN<D>
impl<D> Sync for IncrementalDiskANN<D>
impl<D> Unpin for IncrementalDiskANN<D>where
D: Unpin,
impl<D> UnwindSafe for IncrementalDiskANN<D>where
D: 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more