pub struct SearchRequest {
pub index_name: String,
pub query: SearchQuery,
pub top_k: usize,
pub filter: Option<FilterCondition>,
pub include_vectors: bool,
pub include_metadata: bool,
pub options: HashMap<String, MetadataValue>,
}
Expand description
Search request for querying vectors
Fields§
§index_name: String
Index name to search
query: SearchQuery
Query vector or text
top_k: usize
Number of results to return
filter: Option<FilterCondition>
Optional filter conditions
include_vectors: bool
Whether to include vectors in results
include_metadata: bool
Whether to include metadata in results
options: HashMap<String, MetadataValue>
Search options
Implementations§
Source§impl SearchRequest
impl SearchRequest
Sourcepub fn new(index_name: impl Into<String>, vector: Vec<f32>) -> SearchRequest
pub fn new(index_name: impl Into<String>, vector: Vec<f32>) -> SearchRequest
Create a new search request with a vector query
Sourcepub fn new_text(
index_name: impl Into<String>,
text: impl Into<String>,
) -> SearchRequest
pub fn new_text( index_name: impl Into<String>, text: impl Into<String>, ) -> SearchRequest
Create a new search request with a text query
Sourcepub fn with_top_k(self, top_k: usize) -> SearchRequest
pub fn with_top_k(self, top_k: usize) -> SearchRequest
Set the number of results to return
Sourcepub fn with_filter(self, filter: FilterCondition) -> SearchRequest
pub fn with_filter(self, filter: FilterCondition) -> SearchRequest
Set the filter condition
Sourcepub fn with_include_vectors(self, include: bool) -> SearchRequest
pub fn with_include_vectors(self, include: bool) -> SearchRequest
Set whether to include vectors in results
Sourcepub fn with_include_metadata(self, include: bool) -> SearchRequest
pub fn with_include_metadata(self, include: bool) -> SearchRequest
Set whether to include metadata in results
Sourcepub fn with_option(
self,
key: impl Into<String>,
value: MetadataValue,
) -> SearchRequest
pub fn with_option( self, key: impl Into<String>, value: MetadataValue, ) -> SearchRequest
Add a search option
Trait Implementations§
Source§impl Clone for SearchRequest
impl Clone for SearchRequest
Source§fn clone(&self) -> SearchRequest
fn clone(&self) -> SearchRequest
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 moreAuto Trait Implementations§
impl Freeze for SearchRequest
impl RefUnwindSafe for SearchRequest
impl Send for SearchRequest
impl Sync for SearchRequest
impl Unpin for SearchRequest
impl UnwindSafe for SearchRequest
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