pub enum BackendConfig {
Hnsw {
m: usize,
ef_construction: usize,
distance_metric: DistanceMetric,
is_compact: bool,
is_recompute: bool,
num_threads: usize,
seed: Option<u64>,
},
}Expand description
Backend-specific build configuration.
Each variant holds all parameters needed to build an index with that backend.
Variants§
Hnsw
Implementations§
Source§impl BackendConfig
impl BackendConfig
Sourcepub fn hnsw_default() -> Self
pub fn hnsw_default() -> Self
Default HNSW configuration (matches HnswConfig::default()).
Sourcepub fn from_name(name: &str) -> Result<Self>
pub fn from_name(name: &str) -> Result<Self>
Create a default config for the given backend name.
Sourcepub fn distance_metric(&self) -> DistanceMetric
pub fn distance_metric(&self) -> DistanceMetric
Distance metric for this backend configuration.
Sourcepub fn set_distance_metric(&mut self, metric: DistanceMetric)
pub fn set_distance_metric(&mut self, metric: DistanceMetric)
Set the distance metric.
Sourcepub fn set_ef_construction(&mut self, val: usize)
pub fn set_ef_construction(&mut self, val: usize)
Set efConstruction parameter (HNSW only).
Sourcepub fn set_compact(&mut self, val: bool)
pub fn set_compact(&mut self, val: bool)
Set compact mode (HNSW only).
Sourcepub fn set_recompute(&mut self, val: bool)
pub fn set_recompute(&mut self, val: bool)
Set recompute mode (HNSW only).
Sourcepub fn set_num_threads(&mut self, val: usize)
pub fn set_num_threads(&mut self, val: usize)
Set number of build threads (HNSW only).
Sourcepub fn to_backend_kwargs(&self) -> HashMap<String, Value>
pub fn to_backend_kwargs(&self) -> HashMap<String, Value>
Convert to backend_kwargs map for IndexMeta serialization.
Sourcepub fn to_hnsw_config(&self) -> HnswConfig
pub fn to_hnsw_config(&self) -> HnswConfig
Extract an HnswConfig from this configuration (panics if not HNSW).
Sourcepub fn is_compact(&self) -> bool
pub fn is_compact(&self) -> bool
Whether this config uses compact storage.
Sourcepub fn is_recompute(&self) -> bool
pub fn is_recompute(&self) -> bool
Whether this config uses recompute mode.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BackendConfig
impl RefUnwindSafe for BackendConfig
impl Send for BackendConfig
impl Sync for BackendConfig
impl Unpin for BackendConfig
impl UnsafeUnpin for BackendConfig
impl UnwindSafe for BackendConfig
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