pub struct BinaryDenseVectorConfig {
pub dim: usize,
pub index_type: BinaryIndexType,
pub num_clusters: Option<usize>,
pub target_vectors: Option<u64>,
pub tree_levels: Option<u8>,
pub ivf_routing: IvfRoutingMode,
pub nprobe: usize,
pub soar: Option<SoarConfig>,
}Expand description
Configuration for binary dense vector fields
Binary dense vectors store packed bits (1 bit per dimension) and use
Hamming distance for scoring. Segments accumulate exact packed codes and
use the same global IVF router after build_vector_index.
Fields§
§dim: usizeNumber of bits (dimensions). Storage is ceil(dim/8) bytes per vector.
index_type: BinaryIndexTypeANN index type: Flat (brute-force SIMD Hamming) or Ivf (default)
(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 leaf clusters, selected from corpus and sample size by default.
target_vectors: Option<u64>Expected steady-state vector count used only for automatic topology
sizing. Training readiness still depends on the observed live corpus.
Explicit num_clusters takes precedence over this hint.
tree_levels: Option<u8>Number of levels in the ScaNN Hamming routing tree. When omitted, training derives the depth from corpus size. Only meaningful for ScaNN.
ivf_routing: IvfRoutingModeCoarse-codebook routing strategy. Uses the same routing planner as floating-point IVF indexes.
nprobe: usizeClusters to probe during search (default: 64)
soar: Option<SoarConfig>Optional one-secondary selective spilling for binary ScaNN. The alternate leaf is chosen by exact centroid Hamming distance. Unlike float SOAR, packed bits have no continuous residual geometry.
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_target_vectors(self, target_vectors: u64) -> Self
pub fn with_target_vectors(self, target_vectors: u64) -> Self
Hint the expected steady-state corpus size for automatic topology.
Sourcepub fn with_ivf_routing(self, routing: IvfRoutingMode) -> Self
pub fn with_ivf_routing(self, routing: IvfRoutingMode) -> Self
Set flat, two-level, or HNSW IVF centroid routing explicitly.
Sourcepub fn with_soar(self, soar: SoarConfig) -> Self
pub fn with_soar(self, soar: SoarConfig) -> Self
Enable selective secondary-leaf spilling for binary ScaNN.
Sourcepub fn without_soar(self) -> Self
pub fn without_soar(self) -> Self
Disable binary ScaNN secondary-leaf spilling.
Sourcepub fn optimal_num_clusters(&self, num_vectors: usize) -> usize
pub fn optimal_num_clusters(&self, num_vectors: usize) -> usize
Balanced binary IVF cluster count for a given vector count.
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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 more