#[non_exhaustive]pub struct SemanticSearch {
pub search_text: String,
pub search_field: String,
pub task_type: EmbeddingTaskType,
pub output_fields: Option<OutputFields>,
pub filter: Option<Struct>,
pub top_k: Option<i32>,
pub search_hint: Option<SearchHint>,
/* private fields */
}Expand description
Defines a semantic search operation.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.search_text: StringRequired. The query text, which is used to generate an embedding according to the embedding model specified in the collection config.
search_field: StringRequired. The vector field to search.
task_type: EmbeddingTaskTypeRequired. The task type of the query embedding.
output_fields: Option<OutputFields>Optional. The fields to return in the search results.
filter: Option<Struct>Optional. A JSON filter expression, e.g. {“genre”: {“$eq”: “sci-fi”}}, represented as a google.protobuf.Struct.
top_k: Option<i32>Optional. The number of data objects to return.
search_hint: Option<SearchHint>Optional. Sets the search hint. If no strategy is specified, the service will use an index if one is available, and fall back to KNN search otherwise.
Implementations§
Source§impl SemanticSearch
impl SemanticSearch
pub fn new() -> Self
Sourcepub fn set_search_text<T: Into<String>>(self, v: T) -> Self
pub fn set_search_text<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_search_field<T: Into<String>>(self, v: T) -> Self
pub fn set_search_field<T: Into<String>>(self, v: T) -> Self
Sets the value of search_field.
§Example
let x = SemanticSearch::new().set_search_field("example");Sourcepub fn set_task_type<T: Into<EmbeddingTaskType>>(self, v: T) -> Self
pub fn set_task_type<T: Into<EmbeddingTaskType>>(self, v: T) -> Self
Sets the value of task_type.
§Example
use google_cloud_vectorsearch_v1::model::EmbeddingTaskType;
let x0 = SemanticSearch::new().set_task_type(EmbeddingTaskType::RetrievalQuery);
let x1 = SemanticSearch::new().set_task_type(EmbeddingTaskType::RetrievalDocument);
let x2 = SemanticSearch::new().set_task_type(EmbeddingTaskType::SemanticSimilarity);Sourcepub fn set_output_fields<T>(self, v: T) -> Selfwhere
T: Into<OutputFields>,
pub fn set_output_fields<T>(self, v: T) -> Selfwhere
T: Into<OutputFields>,
Sets the value of output_fields.
§Example
use google_cloud_vectorsearch_v1::model::OutputFields;
let x = SemanticSearch::new().set_output_fields(OutputFields::default()/* use setters */);Sourcepub fn set_or_clear_output_fields<T>(self, v: Option<T>) -> Selfwhere
T: Into<OutputFields>,
pub fn set_or_clear_output_fields<T>(self, v: Option<T>) -> Selfwhere
T: Into<OutputFields>,
Sets or clears the value of output_fields.
§Example
use google_cloud_vectorsearch_v1::model::OutputFields;
let x = SemanticSearch::new().set_or_clear_output_fields(Some(OutputFields::default()/* use setters */));
let x = SemanticSearch::new().set_or_clear_output_fields(None::<OutputFields>);Sourcepub fn set_filter<T>(self, v: T) -> Self
pub fn set_filter<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_filter<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_filter<T>(self, v: Option<T>) -> Self
Sourcepub fn set_or_clear_top_k<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_top_k<T>(self, v: Option<T>) -> Self
Sourcepub fn set_search_hint<T>(self, v: T) -> Selfwhere
T: Into<SearchHint>,
pub fn set_search_hint<T>(self, v: T) -> Selfwhere
T: Into<SearchHint>,
Sets the value of search_hint.
§Example
use google_cloud_vectorsearch_v1::model::SearchHint;
let x = SemanticSearch::new().set_search_hint(SearchHint::default()/* use setters */);Sourcepub fn set_or_clear_search_hint<T>(self, v: Option<T>) -> Selfwhere
T: Into<SearchHint>,
pub fn set_or_clear_search_hint<T>(self, v: Option<T>) -> Selfwhere
T: Into<SearchHint>,
Sets or clears the value of search_hint.
§Example
use google_cloud_vectorsearch_v1::model::SearchHint;
let x = SemanticSearch::new().set_or_clear_search_hint(Some(SearchHint::default()/* use setters */));
let x = SemanticSearch::new().set_or_clear_search_hint(None::<SearchHint>);Trait Implementations§
Source§impl Clone for SemanticSearch
impl Clone for SemanticSearch
Source§fn clone(&self) -> SemanticSearch
fn clone(&self) -> SemanticSearch
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more