pub enum AnyIndex {
Hnsw(HnswIndex),
Ivf(IvfIndex),
ScalarQuantized(ScalarQuantizedIndex),
BinaryQuantized(BinaryQuantizedIndex),
}Variants§
Hnsw(HnswIndex)
Ivf(IvfIndex)
ScalarQuantized(ScalarQuantizedIndex)
BinaryQuantized(BinaryQuantizedIndex)
Implementations§
Source§impl AnyIndex
impl AnyIndex
Sourcepub fn from_config(config: &CollectionConfig) -> Self
pub fn from_config(config: &CollectionConfig) -> Self
Construct the correct variant for the given collection config.
Quantization::ScalarInt8 selects the int8 scalar-quantized flat index
regardless of index_type (HNSW-over-int8 is not yet implemented); the
full-precision on-disk vectors remain authoritative.
Sourcepub fn load_or_create(
data_dir: &Path,
name: &str,
config: &CollectionConfig,
) -> (Self, bool)
pub fn load_or_create( data_dir: &Path, name: &str, config: &CollectionConfig, ) -> (Self, bool)
Load a saved index from data_dir or construct a fresh one.
Returns (index, was_loaded_from_disk).
Trait Implementations§
Source§impl IndexBackend for AnyIndex
impl IndexBackend for AnyIndex
fn build(&mut self, vectors: Vec<(VectorId, Vector)>) -> Result<()>
fn insert(&mut self, id: VectorId, vector: Vector) -> Result<()>
fn search(&self, query: &Vector, k: usize) -> Result<Vec<(VectorId, f32)>>
fn delete(&mut self, id: &VectorId) -> Result<()>
fn save(&self, path: &Path) -> Result<()>
fn load_from(
path: &Path,
config: &CollectionConfig,
) -> Result<Box<dyn IndexBackend>>where
Self: Sized,
fn len(&self) -> usize
fn is_empty(&self) -> bool
fn index_type(&self) -> IndexType
fn rebuild(&mut self, vectors: Vec<(VectorId, Vector)>) -> Result<()>
impl Send for AnyIndex
impl Sync for AnyIndex
Auto Trait Implementations§
impl Freeze for AnyIndex
impl RefUnwindSafe for AnyIndex
impl Unpin for AnyIndex
impl UnsafeUnpin for AnyIndex
impl UnwindSafe for AnyIndex
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
Converts
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> ⓘ
Converts
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