Reference documentation and code samples for the Google Cloud Retail V2 Client class CustomAttribute.
A custom attribute that is not explicitly modeled in Product.
Generated from protobuf message google.cloud.retail.v2.CustomAttribute
Methods
__construct
Constructor.
Parameters | |
---|---|
Name | Description |
data |
array
Optional. Data for populating the Message object. |
↳ text |
array
The textual values of this custom attribute. For example, |
↳ numbers |
array
The numerical values of this custom attribute. For example, |
↳ searchable |
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 |
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. |
getText
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.
Generated from protobuf field repeated string text = 1;
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setText
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.
Generated from protobuf field repeated string text = 1;
Parameter | |
---|---|
Name | Description |
var |
string[]
|
Returns | |
---|---|
Type | Description |
$this |
getNumbers
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.
Generated from protobuf field repeated double numbers = 2;
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setNumbers
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.
Generated from protobuf field repeated double numbers = 2;
Parameter | |
---|---|
Name | Description |
var |
float[]
|
Returns | |
---|---|
Type | Description |
$this |
getSearchable
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.
Generated from protobuf field optional bool searchable = 3 [deprecated = true];
Returns | |
---|---|
Type | Description |
bool |
hasSearchable
clearSearchable
setSearchable
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.
Generated from protobuf field optional bool searchable = 3 [deprecated = true];
Parameter | |
---|---|
Name | Description |
var |
bool
|
Returns | |
---|---|
Type | Description |
$this |
getIndexable
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.
Generated from protobuf field optional bool indexable = 4 [deprecated = true];
Returns | |
---|---|
Type | Description |
bool |
hasIndexable
clearIndexable
setIndexable
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.
Generated from protobuf field optional bool indexable = 4 [deprecated = true];
Parameter | |
---|---|
Name | Description |
var |
bool
|
Returns | |
---|---|
Type | Description |
$this |