pub struct VectorSearchRequestBuilder { /* private fields */ }Expand description
Builder for constructing VectorSearchRequest.
§Example
use laurus::vector::query::VectorSearchRequestBuilder;
let request = VectorSearchRequestBuilder::new()
.add_vector("content", vec![0.1, 0.2, 0.3])
.limit(5)
.build();Implementations§
Source§impl VectorSearchRequestBuilder
impl VectorSearchRequestBuilder
Sourcepub fn add_vector(self, field: impl Into<String>, vector: Vec<f32>) -> Self
pub fn add_vector(self, field: impl Into<String>, vector: Vec<f32>) -> Self
Add a raw query vector for a specific field.
Sourcepub fn add_vector_with_weight(
self,
field: impl Into<String>,
vector: Vec<f32>,
weight: f32,
) -> Self
pub fn add_vector_with_weight( self, field: impl Into<String>, vector: Vec<f32>, weight: f32, ) -> Self
Add a raw query vector with explicit weight for a specific field.
Sourcepub fn add_payload(self, field: impl Into<String>, payload: DataValue) -> Self
pub fn add_payload(self, field: impl Into<String>, payload: DataValue) -> Self
Add a payload to be embedded.
This is the unified method for all modalities (text, image, video, etc.). The bytes will be processed by the configured embedder.
§Arguments
field- The target field namepayload- The payload to add
This is the low-level method used by add_text, add_image, etc.
Sourcepub fn add_bytes(
self,
field: impl Into<String>,
bytes: impl Into<Vec<u8>>,
mime: Option<impl Into<String>>,
) -> Self
pub fn add_bytes( self, field: impl Into<String>, bytes: impl Into<Vec<u8>>, mime: Option<impl Into<String>>, ) -> Self
Add a raw bytes payload (e.g. image bytes).
Sourcepub fn add_text(self, field: impl Into<String>, text: impl Into<String>) -> Self
pub fn add_text(self, field: impl Into<String>, text: impl Into<String>) -> Self
Add a text payload to be embedded.
Sourcepub fn field(self, field: impl Into<String>) -> Self
pub fn field(self, field: impl Into<String>) -> Self
Add a field to search in.
This is a convenience method to add a single field.
Sourcepub fn score_mode(self, mode: VectorScoreMode) -> Self
pub fn score_mode(self, mode: VectorScoreMode) -> Self
Set the score mode.
Sourcepub fn build(self) -> VectorSearchRequest
pub fn build(self) -> VectorSearchRequest
Build the VectorSearchRequest.
If any pre-embedded vectors were added via add_vector
or add_vector_with_weight, the query
will use VectorSearchQuery::Vectors. Otherwise, if payloads were
added via add_payload, add_text,
or add_bytes, the query will use
VectorSearchQuery::Payloads.
Trait Implementations§
Source§impl Clone for VectorSearchRequestBuilder
impl Clone for VectorSearchRequestBuilder
Source§fn clone(&self) -> VectorSearchRequestBuilder
fn clone(&self) -> VectorSearchRequestBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VectorSearchRequestBuilder
impl Debug for VectorSearchRequestBuilder
Auto Trait Implementations§
impl Freeze for VectorSearchRequestBuilder
impl RefUnwindSafe for VectorSearchRequestBuilder
impl Send for VectorSearchRequestBuilder
impl Sync for VectorSearchRequestBuilder
impl Unpin for VectorSearchRequestBuilder
impl UnsafeUnpin for VectorSearchRequestBuilder
impl UnwindSafe for VectorSearchRequestBuilder
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.