pub struct FieldConfig {
pub field_type: FieldType,
pub distance: DistanceType,
pub weight: f32,
}Expand description
Configuration for a single field in the similarity schema
Fields§
§field_type: FieldTypeThe type of the field (text, number, categorical, boolean)
distance: DistanceTypeThe distance/similarity metric to use for this field
weight: f32Weight of this field in the overall similarity score (0.0 to 1.0)
Implementations§
Source§impl FieldConfig
impl FieldConfig
Sourcepub fn text(weight: f32) -> Self
pub fn text(weight: f32) -> Self
Create a text field config
Text fields are compared using trigram similarity during reranking. For semantic search, use client-side embeddings + vector search.
Sourcepub fn number(weight: f32, distance: DistanceType) -> Self
pub fn number(weight: f32, distance: DistanceType) -> Self
Create a number field config
Use Relative for comparing values of different magnitudes (e.g., prices). Use Absolute for values in the same range (e.g., ratings 1-5).
Sourcepub fn categorical(weight: f32) -> Self
pub fn categorical(weight: f32) -> Self
Create a categorical field config
Categorical fields use exact match by default. Use Overlap for multi-value categories.
Trait Implementations§
Source§impl Clone for FieldConfig
impl Clone for FieldConfig
Source§fn clone(&self) -> FieldConfig
fn clone(&self) -> FieldConfig
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FieldConfig
impl Debug for FieldConfig
Source§impl<'de> Deserialize<'de> for FieldConfig
impl<'de> Deserialize<'de> for FieldConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for FieldConfig
impl PartialEq for FieldConfig
Source§impl Serialize for FieldConfig
impl Serialize for FieldConfig
impl StructuralPartialEq for FieldConfig
Auto Trait Implementations§
impl Freeze for FieldConfig
impl RefUnwindSafe for FieldConfig
impl Send for FieldConfig
impl Sync for FieldConfig
impl Unpin for FieldConfig
impl UnwindSafe for FieldConfig
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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