# Class SearchRequest.FacetSpec.FacetKey.Builder (2.95.0)

2.95.0 (latest) 2.93.0 2.90.0 2.89.0 2.87.0 2.85.0 2.84.0 2.82.0 2.80.0 2.78.0 2.77.0 2.76.0 2.75.0 2.74.0 2.72.0 2.70.0 2.69.0 2.66.0 2.65.0 2.64.0 2.62.0 2.61.0 2.60.0 2.59.0 2.58.0 2.57.0 2.56.0 2.55.0 2.54.0 2.53.0 2.51.0 2.50.0 2.49.0 2.48.0 2.47.0 2.46.0 2.45.0 2.44.0 2.43.0 2.42.0 2.41.0 2.39.0 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.0 2.26.0 2.25.0 2.24.0 2.23.0 2.22.0 2.21.0 2.20.0 2.19.0 2.18.0 2.17.0 2.16.0 2.15.0 2.14.0 2.13.0 2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.1 2.4.0 2.3.0 2.2.3 2.1.0 2.0.19

    public static final class SearchRequest.FacetSpec.FacetKey.Builder extends GeneratedMessage.Builder<SearchRequest.FacetSpec.FacetKey.Builder> implements SearchRequest.FacetSpec.FacetKeyOrBuilder

Specifies how a facet is computed.

Protobuf type `google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey`

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> [AbstractMessageLite.Builder\<MessageType,BuilderType\>](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessageLite.Builder.html) \> [AbstractMessage.Builder\<BuilderType\>](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html) \> [GeneratedMessage.Builder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html) \> SearchRequest.FacetSpec.FacetKey.Builder

## Implements

[SearchRequest.FacetSpec.FacetKeyOrBuilder](https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKeyOrBuilder)

## Inherited Members

[AbstractMessage.Builder.findInitializationErrors()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_findInitializationErrors__) [AbstractMessage.Builder.getInitializationErrorString()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_getInitializationErrorString__) [AbstractMessage.Builder.internalMergeFrom(AbstractMessageLite)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_internalMergeFrom_com_google_protobuf_AbstractMessageLite_) [AbstractMessage.Builder.mergeFrom(byte\[\])](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_byte___) [AbstractMessage.Builder.mergeFrom(byte\[\],ExtensionRegistryLite)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_byte___com_google_protobuf_ExtensionRegistryLite_) [AbstractMessage.Builder.mergeFrom(byte\[\],int,int)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_byte___int_int_) [AbstractMessage.Builder.mergeFrom(byte\[\],int,int,ExtensionRegistryLite)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_byte___int_int_com_google_protobuf_ExtensionRegistryLite_) [AbstractMessage.Builder.mergeFrom(ByteString)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_com_google_protobuf_ByteString_) [AbstractMessage.Builder.mergeFrom(ByteString,ExtensionRegistryLite)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_com_google_protobuf_ByteString_com_google_protobuf_ExtensionRegistryLite_) [AbstractMessage.Builder.mergeFrom(CodedInputStream)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_com_google_protobuf_CodedInputStream_) [AbstractMessage.Builder.mergeFrom(CodedInputStream,ExtensionRegistryLite)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_com_google_protobuf_CodedInputStream_com_google_protobuf_ExtensionRegistryLite_) [AbstractMessage.Builder.mergeFrom(Message)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_com_google_protobuf_Message_) [AbstractMessage.Builder.mergeFrom(InputStream)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_java_io_InputStream_) [AbstractMessage.Builder.mergeFrom(InputStream,ExtensionRegistryLite)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_java_io_InputStream_com_google_protobuf_ExtensionRegistryLite_) [AbstractMessage.Builder.newUninitializedMessageException(Message)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_newUninitializedMessageException_com_google_protobuf_Message_) [AbstractMessage.Builder.toString()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_toString__) [AbstractMessageLite.Builder.\<T\>addAll(Iterable\<T\>,Collection\<? super T\>)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessageLite.Builder.html#com_google_protobuf_AbstractMessageLite_Builder__T_addAll_java_lang_Iterable_T__java_util_Collection___super_T__) [AbstractMessageLite.Builder.\<T\>addAll(Iterable\<T\>,List\<? super T\>)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessageLite.Builder.html#com_google_protobuf_AbstractMessageLite_Builder__T_addAll_java_lang_Iterable_T__java_util_List___super_T__) [AbstractMessageLite.Builder.internalMergeFrom(MessageType)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessageLite.Builder.html#com_google_protobuf_AbstractMessageLite_Builder_internalMergeFrom_MessageType_) [AbstractMessageLite.Builder.mergeDelimitedFrom(InputStream)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessageLite.Builder.html#com_google_protobuf_AbstractMessageLite_Builder_mergeDelimitedFrom_java_io_InputStream_) [AbstractMessageLite.Builder.mergeDelimitedFrom(InputStream,ExtensionRegistryLite)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessageLite.Builder.html#com_google_protobuf_AbstractMessageLite_Builder_mergeDelimitedFrom_java_io_InputStream_com_google_protobuf_ExtensionRegistryLite_) [AbstractMessageLite.Builder.mergeFrom(MessageLite)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessageLite.Builder.html#com_google_protobuf_AbstractMessageLite_Builder_mergeFrom_com_google_protobuf_MessageLite_) [AbstractMessageLite.Builder.newUninitializedMessageException(MessageLite)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessageLite.Builder.html#com_google_protobuf_AbstractMessageLite_Builder_newUninitializedMessageException_com_google_protobuf_MessageLite_) [GeneratedMessage.Builder.addRepeatedField(Descriptors.FieldDescriptor,Object)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_addRepeatedField_com_google_protobuf_Descriptors_FieldDescriptor_java_lang_Object_) [GeneratedMessage.Builder.clear()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_clear__) [GeneratedMessage.Builder.clearField(Descriptors.FieldDescriptor)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_clearField_com_google_protobuf_Descriptors_FieldDescriptor_) [GeneratedMessage.Builder.clearOneof(Descriptors.OneofDescriptor)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_clearOneof_com_google_protobuf_Descriptors_OneofDescriptor_) [GeneratedMessage.Builder.clone()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_clone__) [GeneratedMessage.Builder.getAllFields()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getAllFields__) [GeneratedMessage.Builder.getDescriptorForType()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getDescriptorForType__) [GeneratedMessage.Builder.getField(Descriptors.FieldDescriptor)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getField_com_google_protobuf_Descriptors_FieldDescriptor_) [GeneratedMessage.Builder.getFieldBuilder(Descriptors.FieldDescriptor)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getFieldBuilder_com_google_protobuf_Descriptors_FieldDescriptor_) [GeneratedMessage.Builder.getOneofFieldDescriptor(Descriptors.OneofDescriptor)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getOneofFieldDescriptor_com_google_protobuf_Descriptors_OneofDescriptor_) [GeneratedMessage.Builder.getParentForChildren()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getParentForChildren__) [GeneratedMessage.Builder.getRepeatedField(Descriptors.FieldDescriptor,int)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getRepeatedField_com_google_protobuf_Descriptors_FieldDescriptor_int_) [GeneratedMessage.Builder.getRepeatedFieldBuilder(Descriptors.FieldDescriptor,int)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getRepeatedFieldBuilder_com_google_protobuf_Descriptors_FieldDescriptor_int_) [GeneratedMessage.Builder.getRepeatedFieldCount(Descriptors.FieldDescriptor)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getRepeatedFieldCount_com_google_protobuf_Descriptors_FieldDescriptor_) com.google.protobuf.GeneratedMessage.Builder.getUnknownFieldSetBuilder() [GeneratedMessage.Builder.getUnknownFields()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getUnknownFields__) [GeneratedMessage.Builder.hasField(Descriptors.FieldDescriptor)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_hasField_com_google_protobuf_Descriptors_FieldDescriptor_) [GeneratedMessage.Builder.hasOneof(Descriptors.OneofDescriptor)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_hasOneof_com_google_protobuf_Descriptors_OneofDescriptor_) [GeneratedMessage.Builder.internalGetFieldAccessorTable()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_internalGetFieldAccessorTable__) [GeneratedMessage.Builder.internalGetMapField(int)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_internalGetMapField_int_) com.google.protobuf.GeneratedMessage.Builder.internalGetMapFieldReflection(int) [GeneratedMessage.Builder.internalGetMutableMapField(int)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_internalGetMutableMapField_int_) com.google.protobuf.GeneratedMessage.Builder.internalGetMutableMapFieldReflection(int) [GeneratedMessage.Builder.isClean()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_isClean__) [GeneratedMessage.Builder.isInitialized()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_isInitialized__) [GeneratedMessage.Builder.markClean()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_markClean__) [GeneratedMessage.Builder.mergeUnknownFields(UnknownFieldSet)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_mergeUnknownFields_com_google_protobuf_UnknownFieldSet_) com.google.protobuf.GeneratedMessage.Builder.mergeUnknownLengthDelimitedField(int,com.google.protobuf.ByteString) com.google.protobuf.GeneratedMessage.Builder.mergeUnknownVarintField(int,int) [GeneratedMessage.Builder.newBuilderForField(Descriptors.FieldDescriptor)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_newBuilderForField_com_google_protobuf_Descriptors_FieldDescriptor_) [GeneratedMessage.Builder.onBuilt()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_onBuilt__) [GeneratedMessage.Builder.onChanged()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_onChanged__) com.google.protobuf.GeneratedMessage.Builder.parseUnknownField(com.google.protobuf.CodedInputStream,com.google.protobuf.ExtensionRegistryLite,int) [GeneratedMessage.Builder.setField(Descriptors.FieldDescriptor,Object)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_setField_com_google_protobuf_Descriptors_FieldDescriptor_java_lang_Object_) [GeneratedMessage.Builder.setRepeatedField(Descriptors.FieldDescriptor,int,Object)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_setRepeatedField_com_google_protobuf_Descriptors_FieldDescriptor_int_java_lang_Object_) com.google.protobuf.GeneratedMessage.Builder.setUnknownFieldSetBuilder(com.google.protobuf.UnknownFieldSet.Builder) [GeneratedMessage.Builder.setUnknownFields(UnknownFieldSet)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_setUnknownFields_com_google_protobuf_UnknownFieldSet_) com.google.protobuf.GeneratedMessage.Builder.setUnknownFieldsProto3(com.google.protobuf.UnknownFieldSet) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### getDescriptor()

    public static final Descriptors.Descriptor getDescriptor()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.Descriptor.html` |   |

## Methods

### addAllContains(Iterable\<String\> values)

    public SearchRequest.FacetSpec.FacetKey.Builder addAllContains(Iterable<String> values)

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.

`repeated string contains = 9;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `values` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` The contains to add. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### addAllIntervals(Iterable\<? extends Interval\> values)

    public SearchRequest.FacetSpec.FacetKey.Builder addAllIntervals(Iterable<? extends Interval> values)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `values` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html<? extends com.google.cloud.retail.v2alpha.Interval>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

### addAllPrefixes(Iterable\<String\> values)

    public SearchRequest.FacetSpec.FacetKey.Builder addAllPrefixes(Iterable<String> values)

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.

`repeated string prefixes = 8;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `values` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` The prefixes to add. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### addAllRestrictedValues(Iterable\<String\> values)

    public SearchRequest.FacetSpec.FacetKey.Builder addAllRestrictedValues(Iterable<String> values)

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

`repeated string restricted_values = 3;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `values` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` The restrictedValues to add. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### addContains(String value)

    public SearchRequest.FacetSpec.FacetKey.Builder addContains(String value)

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.

`repeated string contains = 9;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The contains to add. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### addContainsBytes(ByteString value)

    public SearchRequest.FacetSpec.FacetKey.Builder addContainsBytes(ByteString value)

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.

`repeated string contains = 9;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` The bytes of the contains to add. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### addIntervals(Interval value)

    public SearchRequest.FacetSpec.FacetKey.Builder addIntervals(Interval value)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

### addIntervals(Interval.Builder builderForValue)

    public SearchRequest.FacetSpec.FacetKey.Builder addIntervals(Interval.Builder builderForValue)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `builderForValue` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval.Builder` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

### addIntervals(int index, Interval value)

    public SearchRequest.FacetSpec.FacetKey.Builder addIntervals(int index, Interval value)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `value` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

### addIntervals(int index, Interval.Builder builderForValue)

    public SearchRequest.FacetSpec.FacetKey.Builder addIntervals(int index, Interval.Builder builderForValue)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `builderForValue` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval.Builder` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

### addIntervalsBuilder()

    public Interval.Builder addIntervalsBuilder()

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval.Builder` |   |

### addIntervalsBuilder(int index)

    public Interval.Builder addIntervalsBuilder(int index)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval.Builder` |   |

### addPrefixes(String value)

    public SearchRequest.FacetSpec.FacetKey.Builder addPrefixes(String value)

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.

`repeated string prefixes = 8;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The prefixes to add. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### addPrefixesBytes(ByteString value)

    public SearchRequest.FacetSpec.FacetKey.Builder addPrefixesBytes(ByteString value)

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.

`repeated string prefixes = 8;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` The bytes of the prefixes to add. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### addRestrictedValues(String value)

    public SearchRequest.FacetSpec.FacetKey.Builder addRestrictedValues(String value)

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

`repeated string restricted_values = 3;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The restrictedValues to add. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### addRestrictedValuesBytes(ByteString value)

    public SearchRequest.FacetSpec.FacetKey.Builder addRestrictedValuesBytes(ByteString value)

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

`repeated string restricted_values = 3;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` The bytes of the restrictedValues to add. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### build()

    public SearchRequest.FacetSpec.FacetKey build()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey` |   |

### buildPartial()

    public SearchRequest.FacetSpec.FacetKey buildPartial()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey` |   |

### clear()

    public SearchRequest.FacetSpec.FacetKey.Builder clear()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

**Overrides** [GeneratedMessage.Builder\<BuilderType\>.clear()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_clear__)

### clearCaseInsensitive()

    public SearchRequest.FacetSpec.FacetKey.Builder clearCaseInsensitive()

True to make facet keys case insensitive when getting faceting
values with prefixes or contains; false otherwise.

`bool case_insensitive = 10;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### clearContains()

    public SearchRequest.FacetSpec.FacetKey.Builder clearContains()

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.

`repeated string contains = 9;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### clearIntervals()

    public SearchRequest.FacetSpec.FacetKey.Builder clearIntervals()

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

### clearKey()

    public SearchRequest.FacetSpec.FacetKey.Builder clearKey()

Required. Supported textual and numerical facet keys in
Product object, over which the
facet values are computed. Facet key is case-sensitive.

Allowed facet keys when
FacetKey.query
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)"

`string key = 1 [(.google.api.field_behavior) = REQUIRED];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### clearOrderBy()

    public SearchRequest.FacetSpec.FacetKey.Builder clearOrderBy()

The order in which
SearchResponse.Facet.values
are returned.

Allowed values are:

- "count desc", which means order by
  SearchResponse.Facet.values.count
  descending.

- "value desc", which means order by
  SearchResponse.Facet.values.value
  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;
  FulfillmentInfo.place_ids
  are sorted in the order given by
  FacetSpec.FacetKey.restricted_values.

`string order_by = 4;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### clearPrefixes()

    public SearchRequest.FacetSpec.FacetKey.Builder clearPrefixes()

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.

`repeated string prefixes = 8;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### clearQuery()

    public SearchRequest.FacetSpec.FacetKey.Builder clearQuery()

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
for detail syntax and limitations. Notice that there is no limitation
on
FacetKey.key
when query is specified.

In the response,
SearchResponse.Facet.values.value
is always "1" and
SearchResponse.Facet.values.count
is the number of results that match the query.

For example, you can set a customized facet for "shipToStore",
where
FacetKey.key
is "customizedShipToStore", and
FacetKey.query
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".

`string query = 5;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### clearRestrictedValues()

    public SearchRequest.FacetSpec.FacetKey.Builder clearRestrictedValues()

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

`repeated string restricted_values = 3;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### clearReturnMinMax()

    public SearchRequest.FacetSpec.FacetKey.Builder clearReturnMinMax()

Returns the min and max value for each numerical facet intervals.
Ignored for textual facets.

`bool return_min_max = 11;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### getCaseInsensitive()

    public boolean getCaseInsensitive()

True to make facet keys case insensitive when getting faceting
values with prefixes or contains; false otherwise.

`bool case_insensitive = 10;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | The caseInsensitive. |

### getContains(int index)

    public String getContains(int index)

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.

`repeated string contains = 9;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index of the element to return. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The contains at the given index. |

### getContainsBytes(int index)

    public ByteString getContainsBytes(int index)

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.

`repeated string contains = 9;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index of the value to return. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes of the contains at the given index. |

### getContainsCount()

    public int getContainsCount()

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.

`repeated string contains = 9;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | The count of contains. |

### getContainsList()

    public ProtocolStringList getContainsList()

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.

`repeated string contains = 9;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ProtocolStringList.html` | A list containing the contains. |

### getDefaultInstanceForType()

    public SearchRequest.FacetSpec.FacetKey getDefaultInstanceForType()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey` |   |

### getDescriptorForType()

    public Descriptors.Descriptor getDescriptorForType()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Descriptors.Descriptor.html` |   |

**Overrides** [GeneratedMessage.Builder\<BuilderType\>.getDescriptorForType()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_getDescriptorForType__)

### getIntervals(int index)

    public Interval getIntervals(int index)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval` |   |

### getIntervalsBuilder(int index)

    public Interval.Builder getIntervalsBuilder(int index)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval.Builder` |   |

### getIntervalsBuilderList()

    public List<Interval.Builder> getIntervalsBuilderList()

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval.Builder>` |   |

### getIntervalsCount()

    public int getIntervalsCount()

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getIntervalsList()

    public List<Interval> getIntervalsList()

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval>` |   |

### getIntervalsOrBuilder(int index)

    public IntervalOrBuilder getIntervalsOrBuilder(int index)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.IntervalOrBuilder` |   |

### getIntervalsOrBuilderList()

    public List<? extends IntervalOrBuilder> getIntervalsOrBuilderList()

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<? extends com.google.cloud.retail.v2alpha.IntervalOrBuilder>` |   |

### getKey()

    public String getKey()

Required. Supported textual and numerical facet keys in
Product object, over which the
facet values are computed. Facet key is case-sensitive.

Allowed facet keys when
FacetKey.query
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)"

`string key = 1 [(.google.api.field_behavior) = REQUIRED];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The key. |

### getKeyBytes()

    public ByteString getKeyBytes()

Required. Supported textual and numerical facet keys in
Product object, over which the
facet values are computed. Facet key is case-sensitive.

Allowed facet keys when
FacetKey.query
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)"

`string key = 1 [(.google.api.field_behavior) = REQUIRED];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for key. |

### getOrderBy()

    public String getOrderBy()

The order in which
SearchResponse.Facet.values
are returned.

Allowed values are:

- "count desc", which means order by
  SearchResponse.Facet.values.count
  descending.

- "value desc", which means order by
  SearchResponse.Facet.values.value
  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;
  FulfillmentInfo.place_ids
  are sorted in the order given by
  FacetSpec.FacetKey.restricted_values.

`string order_by = 4;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The orderBy. |

### getOrderByBytes()

    public ByteString getOrderByBytes()

The order in which
SearchResponse.Facet.values
are returned.

Allowed values are:

- "count desc", which means order by
  SearchResponse.Facet.values.count
  descending.

- "value desc", which means order by
  SearchResponse.Facet.values.value
  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;
  FulfillmentInfo.place_ids
  are sorted in the order given by
  FacetSpec.FacetKey.restricted_values.

`string order_by = 4;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for orderBy. |

### getPrefixes(int index)

    public String getPrefixes(int index)

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.

`repeated string prefixes = 8;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index of the element to return. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The prefixes at the given index. |

### getPrefixesBytes(int index)

    public ByteString getPrefixesBytes(int index)

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.

`repeated string prefixes = 8;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index of the value to return. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes of the prefixes at the given index. |

### getPrefixesCount()

    public int getPrefixesCount()

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.

`repeated string prefixes = 8;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | The count of prefixes. |

### getPrefixesList()

    public ProtocolStringList getPrefixesList()

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.

`repeated string prefixes = 8;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ProtocolStringList.html` | A list containing the prefixes. |

### getQuery()

    public String getQuery()

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
for detail syntax and limitations. Notice that there is no limitation
on
FacetKey.key
when query is specified.

In the response,
SearchResponse.Facet.values.value
is always "1" and
SearchResponse.Facet.values.count
is the number of results that match the query.

For example, you can set a customized facet for "shipToStore",
where
FacetKey.key
is "customizedShipToStore", and
FacetKey.query
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".

`string query = 5;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The query. |

### getQueryBytes()

    public ByteString getQueryBytes()

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
for detail syntax and limitations. Notice that there is no limitation
on
FacetKey.key
when query is specified.

In the response,
SearchResponse.Facet.values.value
is always "1" and
SearchResponse.Facet.values.count
is the number of results that match the query.

For example, you can set a customized facet for "shipToStore",
where
FacetKey.key
is "customizedShipToStore", and
FacetKey.query
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".

`string query = 5;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for query. |

### getRestrictedValues(int index)

    public String getRestrictedValues(int index)

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

`repeated string restricted_values = 3;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index of the element to return. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The restrictedValues at the given index. |

### getRestrictedValuesBytes(int index)

    public ByteString getRestrictedValuesBytes(int index)

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

`repeated string restricted_values = 3;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index of the value to return. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes of the restrictedValues at the given index. |

### getRestrictedValuesCount()

    public int getRestrictedValuesCount()

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

`repeated string restricted_values = 3;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | The count of restrictedValues. |

### getRestrictedValuesList()

    public ProtocolStringList getRestrictedValuesList()

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

`repeated string restricted_values = 3;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ProtocolStringList.html` | A list containing the restrictedValues. |

### getReturnMinMax()

    public boolean getReturnMinMax()

Returns the min and max value for each numerical facet intervals.
Ignored for textual facets.

`bool return_min_max = 11;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | The returnMinMax. |

### internalGetFieldAccessorTable()

    protected GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.FieldAccessorTable.html` |   |

**Overrides** [GeneratedMessage.Builder\<BuilderType\>.internalGetFieldAccessorTable()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_internalGetFieldAccessorTable__)

### isInitialized()

    public final boolean isInitialized()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

**Overrides** [GeneratedMessage.Builder\<BuilderType\>.isInitialized()](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.GeneratedMessage.Builder.html#com_google_protobuf_GeneratedMessage_Builder_isInitialized__)

### mergeFrom(SearchRequest.FacetSpec.FacetKey other)

    public SearchRequest.FacetSpec.FacetKey.Builder mergeFrom(SearchRequest.FacetSpec.FacetKey other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

### mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

    public SearchRequest.FacetSpec.FacetKey.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `input` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.CodedInputStream.html` |
| `extensionRegistry` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ExtensionRegistryLite.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

**Overrides** [AbstractMessage.Builder\<BuilderType\>.mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_com_google_protobuf_CodedInputStream_com_google_protobuf_ExtensionRegistryLite_)

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### mergeFrom(Message other)

    public SearchRequest.FacetSpec.FacetKey.Builder mergeFrom(Message other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Message.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

**Overrides** [AbstractMessage.Builder\<BuilderType\>.mergeFrom(Message other)](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.AbstractMessage.Builder.html#com_google_protobuf_AbstractMessage_Builder_mergeFrom_com_google_protobuf_Message_)

### removeIntervals(int index)

    public SearchRequest.FacetSpec.FacetKey.Builder removeIntervals(int index)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

### setCaseInsensitive(boolean value)

    public SearchRequest.FacetSpec.FacetKey.Builder setCaseInsensitive(boolean value)

True to make facet keys case insensitive when getting faceting
values with prefixes or contains; false otherwise.

`bool case_insensitive = 10;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The caseInsensitive to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### setContains(int index, String value)

    public SearchRequest.FacetSpec.FacetKey.Builder setContains(int index, String value)

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.

`repeated string contains = 9;`

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index to set the value at. |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The contains to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### setIntervals(int index, Interval value)

    public SearchRequest.FacetSpec.FacetKey.Builder setIntervals(int index, Interval value)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `value` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

### setIntervals(int index, Interval.Builder builderForValue)

    public SearchRequest.FacetSpec.FacetKey.Builder setIntervals(int index, Interval.Builder builderForValue)

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.

`repeated .google.cloud.retail.v2alpha.Interval intervals = 2;`

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |
| `builderForValue` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.Interval.Builder` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` |   |

### setKey(String value)

    public SearchRequest.FacetSpec.FacetKey.Builder setKey(String value)

Required. Supported textual and numerical facet keys in
Product object, over which the
facet values are computed. Facet key is case-sensitive.

Allowed facet keys when
FacetKey.query
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)"

`string key = 1 [(.google.api.field_behavior) = REQUIRED];`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The key to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### setKeyBytes(ByteString value)

    public SearchRequest.FacetSpec.FacetKey.Builder setKeyBytes(ByteString value)

Required. Supported textual and numerical facet keys in
Product object, over which the
facet values are computed. Facet key is case-sensitive.

Allowed facet keys when
FacetKey.query
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)"

`string key = 1 [(.google.api.field_behavior) = REQUIRED];`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` The bytes for key to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### setOrderBy(String value)

    public SearchRequest.FacetSpec.FacetKey.Builder setOrderBy(String value)

The order in which
SearchResponse.Facet.values
are returned.

Allowed values are:

- "count desc", which means order by
  SearchResponse.Facet.values.count
  descending.

- "value desc", which means order by
  SearchResponse.Facet.values.value
  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;
  FulfillmentInfo.place_ids
  are sorted in the order given by
  FacetSpec.FacetKey.restricted_values.

`string order_by = 4;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The orderBy to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### setOrderByBytes(ByteString value)

    public SearchRequest.FacetSpec.FacetKey.Builder setOrderByBytes(ByteString value)

The order in which
SearchResponse.Facet.values
are returned.

Allowed values are:

- "count desc", which means order by
  SearchResponse.Facet.values.count
  descending.

- "value desc", which means order by
  SearchResponse.Facet.values.value
  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;
  FulfillmentInfo.place_ids
  are sorted in the order given by
  FacetSpec.FacetKey.restricted_values.

`string order_by = 4;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` The bytes for orderBy to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### setPrefixes(int index, String value)

    public SearchRequest.FacetSpec.FacetKey.Builder setPrefixes(int index, String value)

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.

`repeated string prefixes = 8;`

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index to set the value at. |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The prefixes to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### setQuery(String value)

    public SearchRequest.FacetSpec.FacetKey.Builder setQuery(String value)

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
for detail syntax and limitations. Notice that there is no limitation
on
FacetKey.key
when query is specified.

In the response,
SearchResponse.Facet.values.value
is always "1" and
SearchResponse.Facet.values.count
is the number of results that match the query.

For example, you can set a customized facet for "shipToStore",
where
FacetKey.key
is "customizedShipToStore", and
FacetKey.query
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".

`string query = 5;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The query to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### setQueryBytes(ByteString value)

    public SearchRequest.FacetSpec.FacetKey.Builder setQueryBytes(ByteString value)

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
for detail syntax and limitations. Notice that there is no limitation
on
FacetKey.key
when query is specified.

In the response,
SearchResponse.Facet.values.value
is always "1" and
SearchResponse.Facet.values.count
is the number of results that match the query.

For example, you can set a customized facet for "shipToStore",
where
FacetKey.key
is "customizedShipToStore", and
FacetKey.query
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".

`string query = 5;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` The bytes for query to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### setRestrictedValues(int index, String value)

    public SearchRequest.FacetSpec.FacetKey.Builder setRestrictedValues(int index, String value)

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

`repeated string restricted_values = 3;`

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The index to set the value at. |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` The restrictedValues to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |

### setReturnMinMax(boolean value)

    public SearchRequest.FacetSpec.FacetKey.Builder setReturnMinMax(boolean value)

Returns the min and max value for each numerical facet intervals.
Ignored for textual facets.

`bool return_min_max = 11;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `value` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` The returnMinMax to set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-retail/latest/com.google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.Builder` | This builder for chaining. |