# Google Cloud Retail V2 Client - Class QueryExpansionSpec (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 QueryExpansionSpec.

Specification to determine under which conditions query expansion should
occur.

Generated from protobuf message `google.cloud.retail.v2.SearchRequest.QueryExpansionSpec`

## Namespace

Google \\ Cloud \\ Retail \\ V2 \\ SearchRequest

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ condition` | `int` The condition under which query expansion should occur. Default to [Condition.DISABLED](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.QueryExpansionSpec.Condition#_Google_Cloud_Retail_V2_SearchRequest_QueryExpansionSpec_Condition__DISABLED). |
| `↳ pin_unexpanded_results` | `bool` Whether to pin unexpanded results. The default value is false. If this field is set to true, unexpanded products are always at the top of the search results, followed by the expanded results. |

### getCondition

The condition under which query expansion should occur. Default to
[Condition.DISABLED](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.QueryExpansionSpec.Condition#_Google_Cloud_Retail_V2_SearchRequest_QueryExpansionSpec_Condition__DISABLED).

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

### setCondition

The condition under which query expansion should occur. Default to
[Condition.DISABLED](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.QueryExpansionSpec.Condition#_Google_Cloud_Retail_V2_SearchRequest_QueryExpansionSpec_Condition__DISABLED).

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

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

### getPinUnexpandedResults

Whether to pin unexpanded results. The default value is false. If this
field is set to true,
unexpanded products are always at the top of the search results, followed
by the expanded results.

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

### setPinUnexpandedResults

Whether to pin unexpanded results. The default value is false. If this
field is set to true,
unexpanded products are always at the top of the search results, followed
by the expanded results.

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

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