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

Response message for
[SearchService.Search](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.Client.SearchServiceClient#_Google_Cloud_Retail_V2_Client_SearchServiceClient__search__) method.

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

## Namespace

Google \\ Cloud \\ Retail \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ results` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse.SearchResult>` A list of matched items. The order represents the ranking. |
| `↳ facets` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse.Facet>` Results of facets requested by user. |
| `↳ total_size` | `int` The estimated total count of matched items irrespective of pagination. The count of [results](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getResults__) returned by pagination may be less than the [total_size](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getTotalSize__) that matches. |
| `↳ corrected_query` | `string` Contains the spell corrected query, if found. If the spell correction type is AUTOMATIC, then the search results are based on corrected_query. Otherwise the original query is used for search. |
| `↳ attribution_token` | `string` A unique search token. This should be included in the [UserEvent](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.UserEvent) logs resulting from this search, which enables accurate attribution of search model performance. |
| `↳ next_page_token` | `string` A token that can be sent as [SearchRequest.page_token](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest#_Google_Cloud_Retail_V2_SearchRequest__getPageToken__) to retrieve the next page. If this field is omitted, there are no subsequent pages. |
| `↳ query_expansion_info` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse.QueryExpansionInfo` Query expansion information for the returned results. |
| `↳ redirect_uri` | `string` The URI of a customer-defined redirect page. If redirect action is triggered, no search is performed, and only [redirect_uri](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getRedirectUri__) and [attribution_token](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getAttributionToken__) are set in the response. |
| `↳ applied_controls` | `string[]` The fully qualified resource name of applied [controls](https://cloud.google.com/retail/docs/serving-control-rules). |
| `↳ pin_control_metadata` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.PinControlMetadata` Metadata for pin controls which were applicable to the request. This contains two map fields, one for all matched pins and one for pins which were matched but not applied. The two maps are keyed by pin position, and the values are the product ids which were matched to that pin. |
| `↳ invalid_condition_boost_specs` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.BoostSpec.ConditionBoostSpec>` The invalid [SearchRequest.BoostSpec.condition_boost_specs](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.BoostSpec#_Google_Cloud_Retail_V2_SearchRequest_BoostSpec__getConditionBoostSpecs__) that are not applied during serving. |
| `↳ experiment_info` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.ExperimentInfo>` Metadata related to A/B testing experiment associated with this response. Only exists when an experiment is triggered. |
| `↳ conversational_search_result` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse.ConversationalSearchResult` This field specifies all related information that is needed on client side for UI rendering of conversational retail search. |
| `↳ tile_navigation_result` | `https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse.TileNavigationResult` This field specifies all related information for tile navigation that will be used in client side. |

### getResults

A list of matched items. The order represents the ranking.

| **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.SearchResponse.SearchResult>` |   |

### setResults

A list of matched items. The order represents the ranking.

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

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

### getFacets

Results of facets requested by user.

| **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.SearchResponse.Facet>` |   |

### setFacets

Results of facets requested by user.

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

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

### getTotalSize

The estimated total count of matched items irrespective of pagination. The
count of [results](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getResults__) returned
by pagination may be less than the
[total_size](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getTotalSize__) that
matches.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setTotalSize

The estimated total count of matched items irrespective of pagination. The
count of [results](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getResults__) returned
by pagination may be less than the
[total_size](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getTotalSize__) that
matches.

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

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

### getCorrectedQuery

Contains the spell corrected query, if found. If the spell correction type
is AUTOMATIC, then the search results are based on corrected_query.

Otherwise the original query is used for search.

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

### setCorrectedQuery

Contains the spell corrected query, if found. If the spell correction type
is AUTOMATIC, then the search results are based on corrected_query.

Otherwise the original query is used for search.

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

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

### getAttributionToken

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

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

### setAttributionToken

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

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

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

### getNextPageToken

A token that can be sent as
[SearchRequest.page_token](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest#_Google_Cloud_Retail_V2_SearchRequest__getPageToken__)
to retrieve the next page. If this field is omitted, there are no
subsequent pages.

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

### setNextPageToken

A token that can be sent as
[SearchRequest.page_token](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest#_Google_Cloud_Retail_V2_SearchRequest__getPageToken__)
to retrieve the next page. If this field is omitted, there are no
subsequent pages.

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

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

### getQueryExpansionInfo

Query expansion information for the returned results.

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

### hasQueryExpansionInfo

### clearQueryExpansionInfo

### setQueryExpansionInfo

Query expansion information for the returned results.

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

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

### getRedirectUri

The URI of a customer-defined redirect page. If redirect action is
triggered, no search is performed, and only
[redirect_uri](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getRedirectUri__) and
[attribution_token](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getAttributionToken__)
are set in the response.

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

### setRedirectUri

The URI of a customer-defined redirect page. If redirect action is
triggered, no search is performed, and only
[redirect_uri](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getRedirectUri__) and
[attribution_token](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchResponse#_Google_Cloud_Retail_V2_SearchResponse__getAttributionToken__)
are set in the response.

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

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

### getAppliedControls

The fully qualified resource name of applied
[controls](https://cloud.google.com/retail/docs/serving-control-rules).

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

### setAppliedControls

The fully qualified resource name of applied
[controls](https://cloud.google.com/retail/docs/serving-control-rules).

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

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

### getPinControlMetadata

Metadata for pin controls which were applicable to the request.

This contains two map fields, one for all matched pins and one for pins
which were matched but not applied.
The two maps are keyed by pin position, and the values are the product ids
which were matched to that pin.

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

### hasPinControlMetadata

### clearPinControlMetadata

### setPinControlMetadata

Metadata for pin controls which were applicable to the request.

This contains two map fields, one for all matched pins and one for pins
which were matched but not applied.
The two maps are keyed by pin position, and the values are the product ids
which were matched to that pin.

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

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

### getInvalidConditionBoostSpecs

The invalid
[SearchRequest.BoostSpec.condition_boost_specs](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.BoostSpec#_Google_Cloud_Retail_V2_SearchRequest_BoostSpec__getConditionBoostSpecs__)
that are not applied during serving.

| **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.SearchRequest.BoostSpec.ConditionBoostSpec>` |   |

### setInvalidConditionBoostSpecs

The invalid
[SearchRequest.BoostSpec.condition_boost_specs](https://docs.cloud.google.com/php/docs/reference/cloud-retail/latest/V2.SearchRequest.BoostSpec#_Google_Cloud_Retail_V2_SearchRequest_BoostSpec__getConditionBoostSpecs__)
that are not applied during serving.

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

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

### getExperimentInfo

Metadata related to A/B testing experiment associated with this
response. Only exists when an experiment is triggered.

| **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.ExperimentInfo>` |   |

### setExperimentInfo

Metadata related to A/B testing experiment associated with this
response. Only exists when an experiment is triggered.

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

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

### getConversationalSearchResult

This field specifies all related information that is needed on client
side for UI rendering of conversational retail search.

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

### hasConversationalSearchResult

### clearConversationalSearchResult

### setConversationalSearchResult

This field specifies all related information that is needed on client
side for UI rendering of conversational retail search.

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

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

### getTileNavigationResult

This field specifies all related information for tile navigation that will
be used in client side.

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

### hasTileNavigationResult

### clearTileNavigationResult

### setTileNavigationResult

This field specifies all related information for tile navigation that will
be used in client side.

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

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