pub struct SimilarQuery<'a, Http: HttpClient> {
pub id: &'a str,
pub embedder: &'a str,
pub offset: Option<usize>,
pub limit: Option<usize>,
pub filter: Option<Filter<'a>>,
pub attributes_to_retrieve: Option<Selectors<&'a [&'a str]>>,
pub show_ranking_score: Option<bool>,
pub show_ranking_score_details: Option<bool>,
pub ranking_score_threshold: Option<f64>,
pub retrieve_vectors: Option<bool>,
/* private fields */
}Expand description
Fields§
§id: &'a strIdentifier of the target document
embedder: &'a strEmbedder to use when computing recommendations
offset: Option<usize>Number of documents to skip
limit: Option<usize>Maximum number of documents returned
filter: Option<Filter<'a>>Filter queries by an attribute’s value
Read the dedicated guide to learn the syntax.
attributes_to_retrieve: Option<Selectors<&'a [&'a str]>>Attributes to display in the returned documents.
Can be set to a wildcard value that will select all existing attributes.
Default: all attributes found in the documents.
show_ranking_score: Option<bool>Defines whether to display the global ranking score of a document
Default: false
show_ranking_score_details: Option<bool>Defines whether to display the detailed ranking score information
Default: false
ranking_score_threshold: Option<f64>Defines whether to exclude results with low ranking scores
Default: None
retrieve_vectors: Option<bool>Defines whether to return document vector data
Default: false
Implementations§
Source§impl<'a, Http: HttpClient> SimilarQuery<'a, Http>
impl<'a, Http: HttpClient> SimilarQuery<'a, Http>
pub fn new( index: &'a Index<Http>, id: &'a str, embedder: &'a str, ) -> SimilarQuery<'a, Http>
pub fn with_offset<'b>( &'b mut self, offset: usize, ) -> &'b mut SimilarQuery<'a, Http>
pub fn with_limit<'b>( &'b mut self, limit: usize, ) -> &'b mut SimilarQuery<'a, Http>
pub fn with_filter<'b>( &'b mut self, filter: &'a str, ) -> &'b mut SimilarQuery<'a, Http>
pub fn with_array_filter<'b>( &'b mut self, filter: Vec<&'a str>, ) -> &'b mut SimilarQuery<'a, Http>
pub fn with_attributes_to_retrieve<'b>( &'b mut self, attributes_to_retrieve: Selectors<&'a [&'a str]>, ) -> &'b mut SimilarQuery<'a, Http>
pub fn with_show_ranking_score<'b>( &'b mut self, show_ranking_score: bool, ) -> &'b mut SimilarQuery<'a, Http>
pub fn with_show_ranking_score_details<'b>( &'b mut self, show_ranking_score_details: bool, ) -> &'b mut SimilarQuery<'a, Http>
pub fn with_ranking_score_threshold<'b>( &'b mut self, ranking_score_threshold: f64, ) -> &'b mut SimilarQuery<'a, Http>
pub fn with_retrieve_vectors<'b>( &'b mut self, retrieve_vectors: bool, ) -> &'b mut SimilarQuery<'a, Http>
Sourcepub async fn execute<T: 'static + DeserializeOwned + Send + Sync>(
&'a self,
) -> Result<SimilarResults<T>, Error>
pub async fn execute<T: 'static + DeserializeOwned + Send + Sync>( &'a self, ) -> Result<SimilarResults<T>, Error>
Execute the query and fetch the results.
Trait Implementations§
Source§impl<'a, Http: Clone + HttpClient> Clone for SimilarQuery<'a, Http>
impl<'a, Http: Clone + HttpClient> Clone for SimilarQuery<'a, Http>
Source§fn clone(&self) -> SimilarQuery<'a, Http>
fn clone(&self) -> SimilarQuery<'a, Http>
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<'a, Http: Debug + HttpClient> Debug for SimilarQuery<'a, Http>
impl<'a, Http: Debug + HttpClient> Debug for SimilarQuery<'a, Http>
Source§impl<'a, Http: HttpClient> Serialize for SimilarQuery<'a, Http>
impl<'a, Http: HttpClient> Serialize for SimilarQuery<'a, Http>
Auto Trait Implementations§
impl<'a, Http> Freeze for SimilarQuery<'a, Http>
impl<'a, Http> RefUnwindSafe for SimilarQuery<'a, Http>where
Http: RefUnwindSafe,
impl<'a, Http> Send for SimilarQuery<'a, Http>
impl<'a, Http> Sync for SimilarQuery<'a, Http>
impl<'a, Http> Unpin for SimilarQuery<'a, Http>
impl<'a, Http> UnwindSafe for SimilarQuery<'a, Http>where
Http: RefUnwindSafe,
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