pub struct VectorParams {
pub algorithm: VectorAlgorithm,
pub dim: usize,
pub distance_metric: DistanceMetric,
pub hnsw_m: Option<usize>,
pub hnsw_ef_construction: Option<usize>,
}Expand description
Parameters for RediSearch vector fields.
Fields§
§algorithm: VectorAlgorithmThe algorithm to use (HNSW or FLAT)
dim: usizeVector dimensionality (must match your embeddings)
distance_metric: DistanceMetricDistance metric for similarity calculation
hnsw_m: Option<usize>HNSW M parameter: number of outgoing edges per node (default 16)
hnsw_ef_construction: Option<usize>HNSW EF_CONSTRUCTION: search depth during index building (default 200)
Implementations§
Source§impl VectorParams
impl VectorParams
Sourcepub fn hnsw(dim: usize, distance_metric: DistanceMetric) -> Self
pub fn hnsw(dim: usize, distance_metric: DistanceMetric) -> Self
Create HNSW vector params with sensible defaults. M=16, EF_CONSTRUCTION=200 are RediSearch defaults.
Sourcepub fn flat(dim: usize, distance_metric: DistanceMetric) -> Self
pub fn flat(dim: usize, distance_metric: DistanceMetric) -> Self
Create FLAT vector params.
Sourcepub fn with_m(self, m: usize) -> Self
pub fn with_m(self, m: usize) -> Self
Set HNSW M parameter (number of edges per node). Higher = better recall, more memory. Typical: 12-48.
Sourcepub fn with_ef_construction(self, ef: usize) -> Self
pub fn with_ef_construction(self, ef: usize) -> Self
Set HNSW EF_CONSTRUCTION parameter (build-time search depth). Higher = better index quality, slower build. Typical: 100-500.
Trait Implementations§
Source§impl Clone for VectorParams
impl Clone for VectorParams
Source§fn clone(&self) -> VectorParams
fn clone(&self) -> VectorParams
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VectorParams
impl Debug for VectorParams
Source§impl PartialEq for VectorParams
impl PartialEq for VectorParams
impl StructuralPartialEq for VectorParams
Auto Trait Implementations§
impl Freeze for VectorParams
impl RefUnwindSafe for VectorParams
impl Send for VectorParams
impl Sync for VectorParams
impl Unpin for VectorParams
impl UnwindSafe for VectorParams
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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