# Retail V2 API - Class Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey (v2.9.0)

2.9.0 (latest) 2.8.1 2.7.0 2.6.1 2.5.0 2.4.0 2.3.0 2.2.0 2.1.0 2.0.0 1.3.0 1.2.0 1.1.0 1.0.1 0.21.0 0.20.0 0.19.0 0.18.2 0.17.0 0.16.1 0.15.0 0.14.0 0.13.0 0.12.0 0.11.0 0.10.0 0.9.0 0.8.0 0.7.0 0.6.4 Reference documentation and code samples for the Retail V2 API class Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey.

Specifies how a facet is computed.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #case_insensitive

    def case_insensitive() -> ::Boolean

**Returns**

- (::Boolean) --- True to make facet keys case insensitive when getting faceting values with prefixes or contains; false otherwise.

### #case_insensitive=

    def case_insensitive=(value) -> ::Boolean

**Parameter**

- **value** (::Boolean) --- True to make facet keys case insensitive when getting faceting values with prefixes or contains; false otherwise.
**Returns**

- (::Boolean) --- True to make facet keys case insensitive when getting faceting values with prefixes or contains; false otherwise.

### #contains

    def contains() -> ::Array<::String>

**Returns**

- (::Array\<::String\>) --- Only get facet values that contains the given strings. For example, suppose "categories" has three values "Women \> Shoe", "Women \> Dress" and "Men \> Shoe". If set "contains" to "Shoe", the "categories" facet gives only "Women \> Shoe" and "Men \> Shoe". Only supported on textual fields. Maximum is 10.

### #contains=

    def contains=(value) -> ::Array<::String>

**Parameter**

- **value** (::Array\<::String\>) --- Only get facet values that contains the given strings. For example, suppose "categories" has three values "Women \> Shoe", "Women \> Dress" and "Men \> Shoe". If set "contains" to "Shoe", the "categories" facet gives only "Women \> Shoe" and "Men \> Shoe". Only supported on textual fields. Maximum is 10.
**Returns**

- (::Array\<::String\>) --- Only get facet values that contains the given strings. For example, suppose "categories" has three values "Women \> Shoe", "Women \> Dress" and "Men \> Shoe". If set "contains" to "Shoe", the "categories" facet gives only "Women \> Shoe" and "Men \> Shoe". Only supported on textual fields. Maximum is 10.

### #intervals

    def intervals() -> ::Array<::Google::Cloud::Retail::V2::Interval>

**Returns**

- (::Array\<[::Google::Cloud::Retail::V2::Interval](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Interval)\>) --- Set only if values should be bucketized into intervals. Must be set for facets with numerical values. Must not be set for facet with text values. Maximum number of intervals is 40.


  For all numerical facet keys that appear in the list of products from
  the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
  computed from their distribution weekly. If the model assigns a high
  score to a numerical facet key and its intervals are not specified in
  the search request, these percentiles become the bounds
  for its intervals and are returned in the response. If the
  facet key intervals are specified in the request, then the specified
  intervals are returned instead.

### #intervals=

    def intervals=(value) -> ::Array<::Google::Cloud::Retail::V2::Interval>

**Parameter**

- **value** (::Array\<[::Google::Cloud::Retail::V2::Interval](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Interval)\>) --- Set only if values should be bucketized into intervals. Must be set for facets with numerical values. Must not be set for facet with text values. Maximum number of intervals is 40.


  For all numerical facet keys that appear in the list of products from
  the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
  computed from their distribution weekly. If the model assigns a high
  score to a numerical facet key and its intervals are not specified in
  the search request, these percentiles become the bounds
  for its intervals and are returned in the response. If the
  facet key intervals are specified in the request, then the specified
  intervals are returned instead.
**Returns**

- (::Array\<[::Google::Cloud::Retail::V2::Interval](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Interval)\>) --- Set only if values should be bucketized into intervals. Must be set for facets with numerical values. Must not be set for facet with text values. Maximum number of intervals is 40.


  For all numerical facet keys that appear in the list of products from
  the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
  computed from their distribution weekly. If the model assigns a high
  score to a numerical facet key and its intervals are not specified in
  the search request, these percentiles become the bounds
  for its intervals and are returned in the response. If the
  facet key intervals are specified in the request, then the specified
  intervals are returned instead.

### #key

    def key() -> ::String

**Returns**

- (::String) --- Required. Supported textual and numerical facet keys in
  [Product](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Product "Google::Cloud::Retail::V2::Product (class)") object, over which the facet
  values are computed. Facet key is case-sensitive.

  Allowed facet keys when
  [FacetKey.query](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_query_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query (method)")
  is not specified:
  - textual_field =

    - "brands"
    - "categories"
    - "genders"
    - "ageGroups"
    - "availability"
    - "colorFamilies"
    - "colors"
    - "sizes"
    - "materials"
    - "patterns"
    - "conditions"
    - "attributes.key"
    - "pickupInStore"
    - "shipToStore"
    - "sameDayDelivery"
    - "nextDayDelivery"
    - "customFulfillment1"
    - "customFulfillment2"
    - "customFulfillment3"
    - "customFulfillment4"
    - "customFulfillment5"
    - "inventory(place_id,attributes.key)"
  - numerical_field =

    - "price"
    - "discount"
    - "rating"
    - "ratingCount"
    - "attributes.key"
    - "inventory(place_id,price)"
    - "inventory(place_id,original_price)"
    - "inventory(place_id,attributes.key)"

### #key=

    def key=(value) -> ::String

**Parameter**

- **value** (::String) ---

  Required. Supported textual and numerical facet keys in
  [Product](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Product "Google::Cloud::Retail::V2::Product (class)") object, over which the facet
  values are computed. Facet key is case-sensitive.

  Allowed facet keys when
  [FacetKey.query](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_query_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query (method)")
  is not specified:
  - textual_field =

    - "brands"
    - "categories"
    - "genders"
    - "ageGroups"
    - "availability"
    - "colorFamilies"
    - "colors"
    - "sizes"
    - "materials"
    - "patterns"
    - "conditions"
    - "attributes.key"
    - "pickupInStore"
    - "shipToStore"
    - "sameDayDelivery"
    - "nextDayDelivery"
    - "customFulfillment1"
    - "customFulfillment2"
    - "customFulfillment3"
    - "customFulfillment4"
    - "customFulfillment5"
    - "inventory(place_id,attributes.key)"
  - numerical_field =

    - "price"
    - "discount"
    - "rating"
    - "ratingCount"
    - "attributes.key"
    - "inventory(place_id,price)"
    - "inventory(place_id,original_price)"
    - "inventory(place_id,attributes.key)"
**Returns**

- (::String) --- Required. Supported textual and numerical facet keys in
  [Product](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-Product "Google::Cloud::Retail::V2::Product (class)") object, over which the facet
  values are computed. Facet key is case-sensitive.

  Allowed facet keys when
  [FacetKey.query](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_query_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query (method)")
  is not specified:
  - textual_field =

    - "brands"
    - "categories"
    - "genders"
    - "ageGroups"
    - "availability"
    - "colorFamilies"
    - "colors"
    - "sizes"
    - "materials"
    - "patterns"
    - "conditions"
    - "attributes.key"
    - "pickupInStore"
    - "shipToStore"
    - "sameDayDelivery"
    - "nextDayDelivery"
    - "customFulfillment1"
    - "customFulfillment2"
    - "customFulfillment3"
    - "customFulfillment4"
    - "customFulfillment5"
    - "inventory(place_id,attributes.key)"
  - numerical_field =

    - "price"
    - "discount"
    - "rating"
    - "ratingCount"
    - "attributes.key"
    - "inventory(place_id,price)"
    - "inventory(place_id,original_price)"
    - "inventory(place_id,attributes.key)"

### #order_by

    def order_by() -> ::String

**Returns**

- (::String) --- The order in which [SearchResponse.Facet.values](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet#Google__Cloud__Retail__V2__SearchResponse__Facet_values_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet#values (method)") are returned.


  Allowed values are:
  - "count desc", which means order by
    [SearchResponse.Facet.values.count](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_count_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count (method)")
    descending.

  - "value desc", which means order by
    [SearchResponse.Facet.values.value](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_value_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value (method)")
    descending.
    Only applies to textual facets.

  If not set, textual values are sorted in [natural
  order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
  intervals are sorted in the order given by
  [FacetSpec.FacetKey.intervals](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_intervals_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals (method)");
  [FulfillmentInfo.place_ids](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-FulfillmentInfo#Google__Cloud__Retail__V2__FulfillmentInfo_place_ids_instance_ "Google::Cloud::Retail::V2::FulfillmentInfo#place_ids (method)")
  are sorted in the order given by
  [FacetSpec.FacetKey.restricted_values](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_restricted_values_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#restricted_values (method)").

### #order_by=

    def order_by=(value) -> ::String

**Parameter**

- **value** (::String) --- The order in which [SearchResponse.Facet.values](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet#Google__Cloud__Retail__V2__SearchResponse__Facet_values_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet#values (method)") are returned.


  Allowed values are:
  - "count desc", which means order by
    [SearchResponse.Facet.values.count](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_count_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count (method)")
    descending.

  - "value desc", which means order by
    [SearchResponse.Facet.values.value](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_value_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value (method)")
    descending.
    Only applies to textual facets.

  If not set, textual values are sorted in [natural
  order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
  intervals are sorted in the order given by
  [FacetSpec.FacetKey.intervals](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_intervals_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals (method)");
  [FulfillmentInfo.place_ids](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-FulfillmentInfo#Google__Cloud__Retail__V2__FulfillmentInfo_place_ids_instance_ "Google::Cloud::Retail::V2::FulfillmentInfo#place_ids (method)")
  are sorted in the order given by
  [FacetSpec.FacetKey.restricted_values](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_restricted_values_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#restricted_values (method)").
**Returns**

- (::String) --- The order in which [SearchResponse.Facet.values](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet#Google__Cloud__Retail__V2__SearchResponse__Facet_values_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet#values (method)") are returned.


  Allowed values are:
  - "count desc", which means order by
    [SearchResponse.Facet.values.count](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_count_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count (method)")
    descending.

  - "value desc", which means order by
    [SearchResponse.Facet.values.value](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_value_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value (method)")
    descending.
    Only applies to textual facets.

  If not set, textual values are sorted in [natural
  order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
  intervals are sorted in the order given by
  [FacetSpec.FacetKey.intervals](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_intervals_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#intervals (method)");
  [FulfillmentInfo.place_ids](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-FulfillmentInfo#Google__Cloud__Retail__V2__FulfillmentInfo_place_ids_instance_ "Google::Cloud::Retail::V2::FulfillmentInfo#place_ids (method)")
  are sorted in the order given by
  [FacetSpec.FacetKey.restricted_values](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_restricted_values_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#restricted_values (method)").

### #prefixes

    def prefixes() -> ::Array<::String>

**Returns**

- (::Array\<::String\>) --- Only get facet values that start with the given string prefix. For example, suppose "categories" has three values "Women \> Shoe", "Women \> Dress" and "Men \> Shoe". If set "prefixes" to "Women", the "categories" facet gives only "Women \> Shoe" and "Women \> Dress". Only supported on textual fields. Maximum is 10.

### #prefixes=

    def prefixes=(value) -> ::Array<::String>

**Parameter**

- **value** (::Array\<::String\>) --- Only get facet values that start with the given string prefix. For example, suppose "categories" has three values "Women \> Shoe", "Women \> Dress" and "Men \> Shoe". If set "prefixes" to "Women", the "categories" facet gives only "Women \> Shoe" and "Women \> Dress". Only supported on textual fields. Maximum is 10.
**Returns**

- (::Array\<::String\>) --- Only get facet values that start with the given string prefix. For example, suppose "categories" has three values "Women \> Shoe", "Women \> Dress" and "Men \> Shoe". If set "prefixes" to "Women", the "categories" facet gives only "Women \> Shoe" and "Women \> Dress". Only supported on textual fields. Maximum is 10.

### #query

    def query() -> ::String

**Returns**

- (::String) --- The query that is used to compute facet for the given facet key. When provided, it overrides the default behavior of facet computation. The query syntax is the same as a filter expression. See [SearchRequest.filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest#Google__Cloud__Retail__V2__SearchRequest_filter_instance_ "Google::Cloud::Retail::V2::SearchRequest#filter (method)") for detail syntax and limitations. Notice that there is no limitation on [FacetKey.key](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_key_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key (method)") when query is specified.


  In the response,
  [SearchResponse.Facet.values.value](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_value_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value (method)")
  is always "1" and
  [SearchResponse.Facet.values.count](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_count_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count (method)")
  is the number of results that match the query.

  For example, you can set a customized facet for "shipToStore",
  where
  [FacetKey.key](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_key_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key (method)")
  is "customizedShipToStore", and
  [FacetKey.query](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_query_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query (method)")
  is "availability: ANY(\\"IN_STOCK\\") AND shipToStore: ANY(\\"123\\")".
  Then the facet counts the products that are both in stock and ship
  to store "123".

### #query=

    def query=(value) -> ::String

**Parameter**

- **value** (::String) --- The query that is used to compute facet for the given facet key. When provided, it overrides the default behavior of facet computation. The query syntax is the same as a filter expression. See [SearchRequest.filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest#Google__Cloud__Retail__V2__SearchRequest_filter_instance_ "Google::Cloud::Retail::V2::SearchRequest#filter (method)") for detail syntax and limitations. Notice that there is no limitation on [FacetKey.key](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_key_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key (method)") when query is specified.


  In the response,
  [SearchResponse.Facet.values.value](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_value_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value (method)")
  is always "1" and
  [SearchResponse.Facet.values.count](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_count_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count (method)")
  is the number of results that match the query.

  For example, you can set a customized facet for "shipToStore",
  where
  [FacetKey.key](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_key_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key (method)")
  is "customizedShipToStore", and
  [FacetKey.query](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_query_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query (method)")
  is "availability: ANY(\\"IN_STOCK\\") AND shipToStore: ANY(\\"123\\")".
  Then the facet counts the products that are both in stock and ship
  to store "123".
**Returns**

- (::String) --- The query that is used to compute facet for the given facet key. When provided, it overrides the default behavior of facet computation. The query syntax is the same as a filter expression. See [SearchRequest.filter](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest#Google__Cloud__Retail__V2__SearchRequest_filter_instance_ "Google::Cloud::Retail::V2::SearchRequest#filter (method)") for detail syntax and limitations. Notice that there is no limitation on [FacetKey.key](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_key_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key (method)") when query is specified.


  In the response,
  [SearchResponse.Facet.values.value](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_value_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#value (method)")
  is always "1" and
  [SearchResponse.Facet.values.count](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchResponse-Facet-FacetValue#Google__Cloud__Retail__V2__SearchResponse__Facet__FacetValue_count_instance_ "Google::Cloud::Retail::V2::SearchResponse::Facet::FacetValue#count (method)")
  is the number of results that match the query.

  For example, you can set a customized facet for "shipToStore",
  where
  [FacetKey.key](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_key_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#key (method)")
  is "customizedShipToStore", and
  [FacetKey.query](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-retail-v2/latest/Google-Cloud-Retail-V2-SearchRequest-FacetSpec-FacetKey#Google__Cloud__Retail__V2__SearchRequest__FacetSpec__FacetKey_query_instance_ "Google::Cloud::Retail::V2::SearchRequest::FacetSpec::FacetKey#query (method)")
  is "availability: ANY(\\"IN_STOCK\\") AND shipToStore: ANY(\\"123\\")".
  Then the facet counts the products that are both in stock and ship
  to store "123".

### #restricted_values

    def restricted_values() -> ::Array<::String>

**Returns**

- (::Array\<::String\>) --- Only get facet for the given restricted values. For example, when using
  "pickupInStore" as key and set restricted values to
  \["store123", "store456"\], only facets for "store123" and "store456" are
  returned. Only supported on predefined textual fields, custom textual
  attributes and fulfillments. Maximum is 20.

  Must be set for the fulfillment facet keys:
  - pickupInStore

  - shipToStore

  - sameDayDelivery

  - nextDayDelivery

  - customFulfillment1

  - customFulfillment2

  - customFulfillment3

  - customFulfillment4

  - customFulfillment5

### #restricted_values=

    def restricted_values=(value) -> ::Array<::String>

**Parameter**

- **value** (::Array\<::String\>) ---

  Only get facet for the given restricted values. For example, when using
  "pickupInStore" as key and set restricted values to
  \["store123", "store456"\], only facets for "store123" and "store456" are
  returned. Only supported on predefined textual fields, custom textual
  attributes and fulfillments. Maximum is 20.

  Must be set for the fulfillment facet keys:
  - pickupInStore

  - shipToStore

  - sameDayDelivery

  - nextDayDelivery

  - customFulfillment1

  - customFulfillment2

  - customFulfillment3

  - customFulfillment4

  - customFulfillment5

**Returns**

- (::Array\<::String\>) --- Only get facet for the given restricted values. For example, when using
  "pickupInStore" as key and set restricted values to
  \["store123", "store456"\], only facets for "store123" and "store456" are
  returned. Only supported on predefined textual fields, custom textual
  attributes and fulfillments. Maximum is 20.

  Must be set for the fulfillment facet keys:
  - pickupInStore

  - shipToStore

  - sameDayDelivery

  - nextDayDelivery

  - customFulfillment1

  - customFulfillment2

  - customFulfillment3

  - customFulfillment4

  - customFulfillment5

### #return_min_max

    def return_min_max() -> ::Boolean

**Returns**

- (::Boolean) --- Returns the min and max value for each numerical facet intervals. Ignored for textual facets.

### #return_min_max=

    def return_min_max=(value) -> ::Boolean

**Parameter**

- **value** (::Boolean) --- Returns the min and max value for each numerical facet intervals. Ignored for textual facets.
**Returns**

- (::Boolean) --- Returns the min and max value for each numerical facet intervals. Ignored for textual facets.