pub struct DenseVectorConfig {
pub dim: usize,
pub index_type: VectorIndexType,
pub store_raw: bool,
pub num_clusters: Option<usize>,
pub nprobe: usize,
pub mrl_dim: Option<usize>,
pub build_threshold: Option<usize>,
}Expand description
Configuration for dense vector fields using Flat, RaBitQ, IVF-RaBitQ, or ScaNN
Indexes operate in two states:
- Flat (accumulating): Brute-force search over raw vectors. Used when vector count
is below
build_thresholdor beforebuild_indexis called. - Built (ANN): Fast approximate nearest neighbor search using trained structures. Centroids and codebooks are trained from data and stored within the segment.
Fields§
§dim: usizeDimensionality of vectors
index_type: VectorIndexTypeTarget vector index algorithm (Flat, RaBitQ, IVF-RaBitQ, or ScaNN) When in accumulating state, search uses brute-force regardless of this setting.
store_raw: boolWhether to store raw vectors for re-ranking (increases storage but improves accuracy)
num_clusters: Option<usize>Number of IVF clusters for IVF-RaBitQ and ScaNN (default: sqrt(n) capped at 4096) If None, automatically determined based on dataset size.
nprobe: usizeNumber of clusters to probe during search (default: 32)
mrl_dim: Option<usize>Matryoshka/MRL dimension for index - use only first mrl_dim coordinates for indexing Full vectors are stored but index uses truncated vectors for faster search Must be <= dim. If None, uses full dim.
build_threshold: Option<usize>Minimum number of vectors required before building ANN index. Below this threshold, brute-force (Flat) search is used. Default: 1000 for RaBitQ, 10000 for IVF-RaBitQ/ScaNN.
Implementations§
Source§impl DenseVectorConfig
impl DenseVectorConfig
pub fn new(dim: usize) -> Self
Sourcepub fn with_ivf(dim: usize, num_clusters: Option<usize>, nprobe: usize) -> Self
pub fn with_ivf(dim: usize, num_clusters: Option<usize>, nprobe: usize) -> Self
Create IVF-RaBitQ configuration
Sourcepub fn with_scann(
dim: usize,
num_clusters: Option<usize>,
nprobe: usize,
) -> Self
pub fn with_scann( dim: usize, num_clusters: Option<usize>, nprobe: usize, ) -> Self
Create ScaNN configuration
pub fn without_raw(dim: usize) -> Self
Sourcepub fn with_mrl_dim(self, mrl_dim: usize) -> Self
pub fn with_mrl_dim(self, mrl_dim: usize) -> Self
Set matryoshka/MRL dimension for index truncation
Sourcepub fn with_build_threshold(self, threshold: usize) -> Self
pub fn with_build_threshold(self, threshold: usize) -> Self
Set build threshold for auto-building ANN index
Sourcepub fn with_num_clusters(self, num_clusters: usize) -> Self
pub fn with_num_clusters(self, num_clusters: usize) -> Self
Set number of IVF clusters
Sourcepub fn index_dim(&self) -> usize
pub fn index_dim(&self) -> usize
Get the effective dimension for indexing (mrl_dim if set, otherwise dim)
Sourcepub fn uses_scann(&self) -> bool
pub fn uses_scann(&self) -> bool
Check if this config uses ScaNN
Sourcepub fn default_build_threshold(&self) -> usize
pub fn default_build_threshold(&self) -> usize
Get the default build threshold for this index type
Sourcepub fn optimal_num_clusters(&self, num_vectors: usize) -> usize
pub fn optimal_num_clusters(&self, num_vectors: usize) -> usize
Calculate optimal number of clusters for given vector count
Trait Implementations§
Source§impl Clone for DenseVectorConfig
impl Clone for DenseVectorConfig
Source§fn clone(&self) -> DenseVectorConfig
fn clone(&self) -> DenseVectorConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DenseVectorConfig
impl Debug for DenseVectorConfig
Source§impl<'de> Deserialize<'de> for DenseVectorConfig
impl<'de> Deserialize<'de> for DenseVectorConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for DenseVectorConfig
impl RefUnwindSafe for DenseVectorConfig
impl Send for DenseVectorConfig
impl Sync for DenseVectorConfig
impl Unpin for DenseVectorConfig
impl UnwindSafe for DenseVectorConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.