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

Response of the autocomplete query.

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

## Namespace

Google \\ Cloud \\ Retail \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ completion_results` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.CompleteQueryResponse.CompletionResult>` Results of the matching suggestions. The result list is ordered and the first result is top suggestion. |
| `↳ attribution_token` | `string` A unique complete token. This should be included in the [UserEvent.completion_detail](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UserEvent#_Google_Cloud_Retail_V2_UserEvent__getCompletionDetail__) for search events resulting from this completion, which enables accurate attribution of complete model performance. |
| `↳ recent_search_results` | `array<CompleteQueryResponse\RecentSearchResult>` Deprecated. Matched recent searches of this user. The maximum number of recent searches is 10. This field is a restricted feature. If you want to enable it, contact Retail Search support. This feature is only available when CompleteQueryRequest.visitor_id field is set and [UserEvent](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UserEvent) is imported. The recent searches satisfy the follow rules: \* \* They are ordered from latest to oldest. \* \* They are matched with CompleteQueryRequest.query case insensitively. \* \* They are transformed to lower case. \* \* They are UTF-8 safe. Recent searches are deduplicated. More recent searches will be reserved when duplication happens. |
| `↳ attribute_results` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` A map of matched attribute suggestions. This field is only available for `cloud-retail` dataset. Current supported keys: \* \* `brands` \* \* `categories` |

### getCompletionResults

Results of the matching suggestions. The result list is ordered and the
first result is top suggestion.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.CompleteQueryResponse.CompletionResult>` |   |

### setCompletionResults

Results of the matching suggestions. The result list is ordered and the
first result is top suggestion.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.CompleteQueryResponse.CompletionResult>` |

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

### getAttributionToken

A unique complete token. This should be included in the
[UserEvent.completion_detail](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UserEvent#_Google_Cloud_Retail_V2_UserEvent__getCompletionDetail__)
for search events resulting from this completion, which enables accurate
attribution of complete model performance.

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

### setAttributionToken

A unique complete token. This should be included in the
[UserEvent.completion_detail](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UserEvent#_Google_Cloud_Retail_V2_UserEvent__getCompletionDetail__)
for search events resulting from this completion, which enables accurate
attribution of complete model performance.

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

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

### getRecentSearchResults

Deprecated. Matched recent searches of this user. The maximum number of
recent searches is 10. This field is a restricted feature. If you want to
enable it, contact Retail Search support.

This feature is only available when
CompleteQueryRequest.visitor_id
field is set and [UserEvent](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UserEvent) is imported.
The recent searches satisfy the follow rules:

- They are ordered from latest to oldest.
- They are matched with CompleteQueryRequest.query case insensitively.
- They are transformed to lower case.
- They are UTF-8 safe. Recent searches are deduplicated. More recent searches will be reserved when duplication happens.

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

### setRecentSearchResults

Deprecated. Matched recent searches of this user. The maximum number of
recent searches is 10. This field is a restricted feature. If you want to
enable it, contact Retail Search support.

This feature is only available when
CompleteQueryRequest.visitor_id
field is set and [UserEvent](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UserEvent) is imported.
The recent searches satisfy the follow rules:

- They are ordered from latest to oldest.
- They are matched with CompleteQueryRequest.query case insensitively.
- They are transformed to lower case.
- They are UTF-8 safe. Recent searches are deduplicated. More recent searches will be reserved when duplication happens.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<CompleteQueryResponse\RecentSearchResult>` |

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

### getAttributeResults

A map of matched attribute suggestions. This field is only available for
`cloud-retail` dataset.

Current supported keys:

- `brands`
- `categories`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setAttributeResults

A map of matched attribute suggestions. This field is only available for
`cloud-retail` dataset.

Current supported keys:

- `brands`
- `categories`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

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