#[non_exhaustive]pub struct CustomAttribute {
pub text: Vec<String>,
pub numbers: Vec<f64>,
pub searchable: Option<bool>,
pub indexable: Option<bool>,
/* private fields */
}Expand description
A custom attribute that is not explicitly modeled in Product.
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.text: Vec<String>The textual values of this custom attribute. For example, ["yellow", "green"] when the key is “color”.
Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is returned.
Exactly one of text or numbers should be set. Otherwise, an INVALID_ARGUMENT error is returned.
numbers: Vec<f64>The numerical values of this custom attribute. For example, [2.3, 15.4]
when the key is “lengths_cm”.
Exactly one of text or numbers should be set. Otherwise, an INVALID_ARGUMENT error is returned.
searchable: Option<bool>This field is normally ignored unless AttributesConfig.attribute_config_level of the Catalog is set to the deprecated ‘PRODUCT_LEVEL_ATTRIBUTE_CONFIG’ mode. For information about product-level attribute configuration, see Configuration modes. If true, custom attribute values are searchable by text queries in SearchService.Search.
This field is ignored in a UserEvent.
Only set if type text is set. Otherwise, a INVALID_ARGUMENT error is returned.
indexable: Option<bool>This field is normally ignored unless AttributesConfig.attribute_config_level of the Catalog is set to the deprecated ‘PRODUCT_LEVEL_ATTRIBUTE_CONFIG’ mode. For information about product-level attribute configuration, see Configuration modes. If true, custom attribute values are indexed, so that they can be filtered, faceted or boosted in SearchService.Search.
This field is ignored in a UserEvent.
See SearchRequest.filter, SearchRequest.facet_specs and SearchRequest.boost_spec for more details.
Implementations§
Source§impl CustomAttribute
impl CustomAttribute
Sourcepub fn set_numbers<T, V>(self, v: T) -> Self
pub fn set_numbers<T, V>(self, v: T) -> Self
Sourcepub fn set_searchable<T>(self, v: T) -> Self
👎Deprecated
pub fn set_searchable<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_searchable<T>(self, v: Option<T>) -> Self
👎Deprecated
pub fn set_or_clear_searchable<T>(self, v: Option<T>) -> Self
Sets or clears the value of searchable.
§Example
let x = CustomAttribute::new().set_or_clear_searchable(Some(false));
let x = CustomAttribute::new().set_or_clear_searchable(None::<bool>);Sourcepub fn set_indexable<T>(self, v: T) -> Self
👎Deprecated
pub fn set_indexable<T>(self, v: T) -> Self
Trait Implementations§
Source§impl Clone for CustomAttribute
impl Clone for CustomAttribute
Source§fn clone(&self) -> CustomAttribute
fn clone(&self) -> CustomAttribute
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CustomAttribute
impl Debug for CustomAttribute
Source§impl Default for CustomAttribute
impl Default for CustomAttribute
Source§fn default() -> CustomAttribute
fn default() -> CustomAttribute
Source§impl Message for CustomAttribute
impl Message for CustomAttribute
Source§impl PartialEq for CustomAttribute
impl PartialEq for CustomAttribute
impl StructuralPartialEq for CustomAttribute
Auto Trait Implementations§
impl Freeze for CustomAttribute
impl RefUnwindSafe for CustomAttribute
impl Send for CustomAttribute
impl Sync for CustomAttribute
impl Unpin for CustomAttribute
impl UnsafeUnpin for CustomAttribute
impl UnwindSafe for CustomAttribute
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request