#[non_exhaustive]pub struct CompletionSuggestion {
pub suggestion: String,
pub language_code: String,
pub group_id: String,
pub group_score: f64,
pub alternative_phrases: Vec<String>,
pub ranking_info: Option<RankingInfo>,
/* private fields */
}completion-service only.Expand description
Autocomplete suggestions that are imported from Customer.
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.suggestion: StringRequired. The suggestion text.
language_code: StringBCP-47 language code of this suggestion.
group_id: StringIf two suggestions have the same groupId, they will not be returned together. Instead the one ranked higher will be returned. This can be used to deduplicate semantically identical suggestions.
group_score: f64The score of this suggestion within its group.
alternative_phrases: Vec<String>Alternative matching phrases for this suggestion.
ranking_info: Option<RankingInfo>Ranking metrics of this suggestion.
Implementations§
Source§impl CompletionSuggestion
impl CompletionSuggestion
pub fn new() -> Self
Sourcepub fn set_suggestion<T: Into<String>>(self, v: T) -> Self
pub fn set_suggestion<T: Into<String>>(self, v: T) -> Self
Sets the value of suggestion.
§Example
let x = CompletionSuggestion::new().set_suggestion("example");Sourcepub fn set_language_code<T: Into<String>>(self, v: T) -> Self
pub fn set_language_code<T: Into<String>>(self, v: T) -> Self
Sets the value of language_code.
§Example
let x = CompletionSuggestion::new().set_language_code("example");Sourcepub fn set_group_id<T: Into<String>>(self, v: T) -> Self
pub fn set_group_id<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_group_score<T: Into<f64>>(self, v: T) -> Self
pub fn set_group_score<T: Into<f64>>(self, v: T) -> Self
Sourcepub fn set_alternative_phrases<T, V>(self, v: T) -> Self
pub fn set_alternative_phrases<T, V>(self, v: T) -> Self
Sets the value of alternative_phrases.
§Example
let x = CompletionSuggestion::new().set_alternative_phrases(["a", "b", "c"]);Sourcepub fn set_ranking_info<T: Into<Option<RankingInfo>>>(self, v: T) -> Self
pub fn set_ranking_info<T: Into<Option<RankingInfo>>>(self, v: T) -> Self
Sets the value of ranking_info.
Note that all the setters affecting ranking_info are mutually
exclusive.
§Example
use google_cloud_discoveryengine_v1::model::completion_suggestion::RankingInfo;
let x = CompletionSuggestion::new().set_ranking_info(Some(RankingInfo::GlobalScore(42.0)));Sourcepub fn global_score(&self) -> Option<&f64>
pub fn global_score(&self) -> Option<&f64>
The value of ranking_info
if it holds a GlobalScore, None if the field is not set or
holds a different branch.
Sourcepub fn set_global_score<T: Into<f64>>(self, v: T) -> Self
pub fn set_global_score<T: Into<f64>>(self, v: T) -> Self
Sets the value of ranking_info
to hold a GlobalScore.
Note that all the setters affecting ranking_info are
mutually exclusive.
§Example
let x = CompletionSuggestion::new().set_global_score(42.0);
assert!(x.global_score().is_some());
assert!(x.frequency().is_none());Sourcepub fn frequency(&self) -> Option<&i64>
pub fn frequency(&self) -> Option<&i64>
The value of ranking_info
if it holds a Frequency, None if the field is not set or
holds a different branch.
Sourcepub fn set_frequency<T: Into<i64>>(self, v: T) -> Self
pub fn set_frequency<T: Into<i64>>(self, v: T) -> Self
Sets the value of ranking_info
to hold a Frequency.
Note that all the setters affecting ranking_info are
mutually exclusive.
§Example
let x = CompletionSuggestion::new().set_frequency(42);
assert!(x.frequency().is_some());
assert!(x.global_score().is_none());Trait Implementations§
Source§impl Clone for CompletionSuggestion
impl Clone for CompletionSuggestion
Source§fn clone(&self) -> CompletionSuggestion
fn clone(&self) -> CompletionSuggestion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more