# Google Cloud Retail V2 Client - Class ServingConfig (2.5.3)

2.5.3 (latest) 2.5.2 2.4.0 2.3.1 2.2.1 2.1.3 2.0.0 1.7.0 1.6.4 1.5.0 1.4.2 1.3.1 1.2.1 1.1.1 1.0.1 Reference documentation and code samples for the Google Cloud Retail V2 Client class ServingConfig.

Configures metadata that is used to generate serving time results (e.g.

search results or recommendation predictions).

Generated from protobuf message `google.cloud.retail.v2.ServingConfig`

## Namespace

Google \\ Cloud \\ Retail \\ V2

## Methods

### __construct

Constructor.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `data` | `mixed` |

### getName

Immutable. Fully qualified name
`projects/*/locations/global/catalogs/*/servingConfig/*`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Immutable. Fully qualified name
`projects/*/locations/global/catalogs/*/servingConfig/*`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDisplayName

Required. The human readable serving config display name. Used in Retail
UI.

This field must be a UTF-8 encoded string with a length limit of 128
characters. Otherwise, an INVALID_ARGUMENT error is returned.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDisplayName

Required. The human readable serving config display name. Used in Retail
UI.

This field must be a UTF-8 encoded string with a length limit of 128
characters. Otherwise, an INVALID_ARGUMENT error is returned.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getModelId

The id of the model in the same [Catalog](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Catalog)
to use at serving time. Currently only RecommendationModels are supported:
<https://cloud.google.com/retail/recommendations-ai/docs/create-models>
Can be changed but only to a compatible model (e.g.

others-you-may-like CTR to others-you-may-like CVR).
Required when
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_RECOMMENDATION](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_RECOMMENDATION).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setModelId

The id of the model in the same [Catalog](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Catalog)
to use at serving time. Currently only RecommendationModels are supported:
<https://cloud.google.com/retail/recommendations-ai/docs/create-models>
Can be changed but only to a compatible model (e.g.

others-you-may-like CTR to others-you-may-like CVR).
Required when
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_RECOMMENDATION](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_RECOMMENDATION).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPriceRerankingLevel

How much price ranking we want in serving results.

Price reranking causes product items with a similar
recommendation probability to be ordered by price, with the
highest-priced items first. This setting could result in a decrease in
click-through and conversion rates.
Allowed values are:

- `no-price-reranking`
- `low-price-reranking`
- `medium-price-reranking`
- `high-price-reranking` If not specified, we choose default based on model type. Default value: `no-price-reranking`. Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_RECOMMENDATION](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_RECOMMENDATION).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setPriceRerankingLevel

How much price ranking we want in serving results.

Price reranking causes product items with a similar
recommendation probability to be ordered by price, with the
highest-priced items first. This setting could result in a decrease in
click-through and conversion rates.
Allowed values are:

- `no-price-reranking`
- `low-price-reranking`
- `medium-price-reranking`
- `high-price-reranking` If not specified, we choose default based on model type. Default value: `no-price-reranking`. Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_RECOMMENDATION](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_RECOMMENDATION).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getFacetControlIds

Facet specifications for faceted search. If empty, no facets are returned.

The ids refer to the ids of [Control](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Control)
resources with only the Facet control set. These controls are assumed to be
in the same [Catalog](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Catalog) as the
[ServingConfig](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig).
A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
is returned.
Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setFacetControlIds

Facet specifications for faceted search. If empty, no facets are returned.

The ids refer to the ids of [Control](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Control)
resources with only the Facet control set. These controls are assumed to be
in the same [Catalog](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Catalog) as the
[ServingConfig](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig).
A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
is returned.
Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDynamicFacetSpec

The specification for dynamically generated facets. Notice that only
textual facets can be dynamically generated.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.DynamicFacetSpec|null` |   |

### hasDynamicFacetSpec

### clearDynamicFacetSpec

### setDynamicFacetSpec

The specification for dynamically generated facets. Notice that only
textual facets can be dynamically generated.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.DynamicFacetSpec` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBoostControlIds

Condition boost specifications. If a product matches multiple conditions
in the specifications, boost scores from these specifications are all
applied and combined in a non-linear way. Maximum number of
specifications is 100.

Notice that if both
[ServingConfig.boost_control_ids](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getBoostControlIds__)
and
[SearchRequest.boost_spec](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest#_Google_Cloud_Retail_V2_SearchRequest__getBoostSpec__)
are set, the boost conditions from both places are evaluated. If a search
request matches multiple boost conditions, the final boost score is equal
to the sum of the boost scores from all matched boost conditions.
Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setBoostControlIds

Condition boost specifications. If a product matches multiple conditions
in the specifications, boost scores from these specifications are all
applied and combined in a non-linear way. Maximum number of
specifications is 100.

Notice that if both
[ServingConfig.boost_control_ids](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getBoostControlIds__)
and
[SearchRequest.boost_spec](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest#_Google_Cloud_Retail_V2_SearchRequest__getBoostSpec__)
are set, the boost conditions from both places are evaluated. If a search
request matches multiple boost conditions, the final boost score is equal
to the sum of the boost scores from all matched boost conditions.
Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getFilterControlIds

Condition filter specifications. If a product matches multiple conditions
in the specifications, filters from these specifications are all
applied and combined via the AND operator. Maximum number of
specifications is 100.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setFilterControlIds

Condition filter specifications. If a product matches multiple conditions
in the specifications, filters from these specifications are all
applied and combined via the AND operator. Maximum number of
specifications is 100.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRedirectControlIds

Condition redirect specifications. Only the first triggered redirect action
is applied, even if multiple apply. Maximum number of specifications is
1000.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setRedirectControlIds

Condition redirect specifications. Only the first triggered redirect action
is applied, even if multiple apply. Maximum number of specifications is
1000.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTwowaySynonymsControlIds

Condition synonyms specifications. If multiple syonyms conditions match,
all matching synonyms control in the list will execute. Order of controls
in the list will not matter. Maximum number of specifications is
100.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setTwowaySynonymsControlIds

Condition synonyms specifications. If multiple syonyms conditions match,
all matching synonyms control in the list will execute. Order of controls
in the list will not matter. Maximum number of specifications is
100.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOnewaySynonymsControlIds

Condition oneway synonyms specifications. If multiple oneway synonyms
conditions match, all matching oneway synonyms controls in the list will
execute. Order of controls in the list will not matter. Maximum number of
specifications is 100.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setOnewaySynonymsControlIds

Condition oneway synonyms specifications. If multiple oneway synonyms
conditions match, all matching oneway synonyms controls in the list will
execute. Order of controls in the list will not matter. Maximum number of
specifications is 100.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDoNotAssociateControlIds

Condition do not associate specifications. If multiple do not associate
conditions match, all matching do not associate controls in the list will
execute.

- Order does not matter.
- Maximum number of specifications is 100. Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setDoNotAssociateControlIds

Condition do not associate specifications. If multiple do not associate
conditions match, all matching do not associate controls in the list will
execute.

- Order does not matter.
- Maximum number of specifications is 100. Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getReplacementControlIds

Condition replacement specifications.

- Applied according to the order in the list.
- A previously replaced term can not be re-replaced.
- Maximum number of specifications is 100. Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setReplacementControlIds

Condition replacement specifications.

- Applied according to the order in the list.
- A previously replaced term can not be re-replaced.
- Maximum number of specifications is 100. Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIgnoreControlIds

Condition ignore specifications. If multiple ignore
conditions match, all matching ignore controls in the list will
execute.

- Order does not matter.
- Maximum number of specifications is 100. Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setIgnoreControlIds

Condition ignore specifications. If multiple ignore
conditions match, all matching ignore controls in the list will
execute.

- Order does not matter.
- Maximum number of specifications is 100. Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDiversityLevel

How much diversity to use in recommendation model results e.g.

`medium-diversity` or `high-diversity`. Currently supported values:

- `no-diversity`
- `low-diversity`
- `medium-diversity`
- `high-diversity`
- `auto-diversity` If not specified, we choose default based on recommendation model type. Default value: `no-diversity`. Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_RECOMMENDATION](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_RECOMMENDATION).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDiversityLevel

How much diversity to use in recommendation model results e.g.

`medium-diversity` or `high-diversity`. Currently supported values:

- `no-diversity`
- `low-diversity`
- `medium-diversity`
- `high-diversity`
- `auto-diversity` If not specified, we choose default based on recommendation model type. Default value: `no-diversity`. Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_RECOMMENDATION](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_RECOMMENDATION).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDiversityType

What kind of diversity to use - data driven or rule based. If unset, the
server behavior defaults to
[RULE_BASED_DIVERSITY](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig.DiversityType#_Google_Cloud_Retail_V2_ServingConfig_DiversityType__RULE_BASED_DIVERSITY).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [DiversityType](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig.DiversityType). |

### setDiversityType

What kind of diversity to use - data driven or rule based. If unset, the
server behavior defaults to
[RULE_BASED_DIVERSITY](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig.DiversityType#_Google_Cloud_Retail_V2_ServingConfig_DiversityType__RULE_BASED_DIVERSITY).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [DiversityType](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig.DiversityType). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEnableCategoryFilterLevel

Whether to add additional category filters on the `similar-items` model.

If not specified, we enable it by default.
Allowed values are:

- `no-category-match`: No additional filtering of original results from the model and the customer's filters.
- `relaxed-category-match`: Only keep results with categories that match at least one item categories in the PredictRequests's context item.
  - If customer also sends filters in the PredictRequest, then the results will satisfy both conditions (user given and category match). Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_RECOMMENDATION](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_RECOMMENDATION).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setEnableCategoryFilterLevel

Whether to add additional category filters on the `similar-items` model.

If not specified, we enable it by default.
Allowed values are:

- `no-category-match`: No additional filtering of original results from the model and the customer's filters.
- `relaxed-category-match`: Only keep results with categories that match at least one item categories in the PredictRequests's context item.
  - If customer also sends filters in the PredictRequest, then the results will satisfy both conditions (user given and category match). Can only be set if [solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is [SOLUTION_TYPE_RECOMMENDATION](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_RECOMMENDATION).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIgnoreRecsDenylist

When the flag is enabled, the products in the denylist will not be filtered
out in the recommendation filtering results.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setIgnoreRecsDenylist

When the flag is enabled, the products in the denylist will not be filtered
out in the recommendation filtering results.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPersonalizationSpec

The specification for personalization spec.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).
Notice that if both
[ServingConfig.personalization_spec](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getPersonalizationSpec__)
and
[SearchRequest.personalization_spec](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest#_Google_Cloud_Retail_V2_SearchRequest__getPersonalizationSpec__)
are set.
[SearchRequest.personalization_spec](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest#_Google_Cloud_Retail_V2_SearchRequest__getPersonalizationSpec__)
will override
[ServingConfig.personalization_spec](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getPersonalizationSpec__).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.PersonalizationSpec|null` |   |

### hasPersonalizationSpec

### clearPersonalizationSpec

### setPersonalizationSpec

The specification for personalization spec.

Can only be set if
[solution_types](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getSolutionTypes__) is
[SOLUTION_TYPE_SEARCH](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SolutionType#_Google_Cloud_Retail_V2_SolutionType__SOLUTION_TYPE_SEARCH).
Notice that if both
[ServingConfig.personalization_spec](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getPersonalizationSpec__)
and
[SearchRequest.personalization_spec](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest#_Google_Cloud_Retail_V2_SearchRequest__getPersonalizationSpec__)
are set.
[SearchRequest.personalization_spec](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest#_Google_Cloud_Retail_V2_SearchRequest__getPersonalizationSpec__)
will override
[ServingConfig.personalization_spec](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ServingConfig#_Google_Cloud_Retail_V2_ServingConfig__getPersonalizationSpec__).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.PersonalizationSpec` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSolutionTypes

Required. Immutable. Specifies the solution types that a serving config can
be associated with. Currently we support setting only one type of solution.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<int>` |   |

### setSolutionTypes

Required. Immutable. Specifies the solution types that a serving config can
be associated with. Currently we support setting only one type of solution.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |