pub struct BinaryDenseVectorConfig {
pub dim: usize,
pub index_type: BinaryIndexType,
pub num_clusters: Option<usize>,
pub nprobe: usize,
pub build_threshold: Option<usize>,
}Expand description
Configuration for binary dense vector fields
Binary dense vectors store packed bits (1 bit per dimension) and use Hamming distance for scoring. Always uses brute-force flat search (Hamming popcount is ~10ns/vec for 768-bit, ANN indexes don’t help).
Fields§
§dim: usizeNumber of bits (dimensions). Storage is ceil(dim/8) bytes per vector.
index_type: BinaryIndexTypeANN index type: Flat (brute-force SIMD Hamming, default) or Ivf
(k-majority Hamming clusters — probe nprobe clusters at query time).
IVF pays off for segments past a few million vectors.
num_clusters: Option<usize>Number of IVF clusters (default: sqrt(n) capped at 4096)
nprobe: usizeClusters to probe during search (default: 32)
build_threshold: Option<usize>Minimum vectors before building the IVF index (default: 100_000 — below that brute-force SIMD Hamming is faster than probing).
Implementations§
Source§impl BinaryDenseVectorConfig
impl BinaryDenseVectorConfig
pub fn new(dim: usize) -> Self
Sourcepub fn with_ivf(self, num_clusters: Option<usize>, nprobe: usize) -> Self
pub fn with_ivf(self, num_clusters: Option<usize>, nprobe: usize) -> Self
Enable the IVF index (builder pattern)
Sourcepub fn with_build_threshold(self, threshold: usize) -> Self
pub fn with_build_threshold(self, threshold: usize) -> Self
Set the build threshold (builder pattern)
Sourcepub fn default_build_threshold(&self) -> usize
pub fn default_build_threshold(&self) -> usize
Default build threshold: brute-force wins below ~100K vectors.
Sourcepub fn optimal_num_clusters(&self, num_vectors: usize) -> usize
pub fn optimal_num_clusters(&self, num_vectors: usize) -> usize
Optimal cluster count for a given vector count (sqrt(n), capped)
Trait Implementations§
Source§impl Clone for BinaryDenseVectorConfig
impl Clone for BinaryDenseVectorConfig
Source§fn clone(&self) -> BinaryDenseVectorConfig
fn clone(&self) -> BinaryDenseVectorConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BinaryDenseVectorConfig
impl Debug for BinaryDenseVectorConfig
Source§impl<'de> Deserialize<'de> for BinaryDenseVectorConfig
impl<'de> Deserialize<'de> for BinaryDenseVectorConfig
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 BinaryDenseVectorConfig
impl RefUnwindSafe for BinaryDenseVectorConfig
impl Send for BinaryDenseVectorConfig
impl Sync for BinaryDenseVectorConfig
impl Unpin for BinaryDenseVectorConfig
impl UnsafeUnpin for BinaryDenseVectorConfig
impl UnwindSafe for BinaryDenseVectorConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DropFlavorWrapper<T> for T
impl<T> DropFlavorWrapper<T> for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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>
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<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<E> ResultError for E
impl<T> ResultType 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.