# Google Cloud Discovery Engine V1 Client - Class SearchResponse (1.11.1)

1.11.1 (latest) 1.11.0 1.10.1 1.9.1 1.8.0 1.7.0 1.6.1 1.5.1 1.4.0 1.3.3 1.2.0 1.1.0 1.0.0 0.11.3 0.8.0 0.7.1 0.6.0 0.5.0 0.4.0 0.3.0 0.2.0 0.1.1 Reference documentation and code samples for the Google Cloud Discovery Engine V1 Client class SearchResponse.

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

Generated from protobuf message `google.cloud.discoveryengine.v1.SearchResponse`

## Namespace

Google \\ Cloud \\ DiscoveryEngine \\ V1

## 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-discoveryengine/latest/V1.SearchResponse.SearchResult>` A list of matched documents. The order represents the ranking. |
| `↳ facets` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.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-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_SearchResponse__getResults__) returned by pagination may be less than the [total_size](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_SearchResponse__getTotalSize__) that matches. |
| `↳ attribution_token` | `string` A unique search token. This should be included in the [UserEvent](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.UserEvent) logs resulting from this search, which enables accurate attribution of search model performance. This also helps to identify a request during the customer support scenarios. |
| `↳ 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-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_SearchResponse__getRedirectUri__) and [attribution_token](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_SearchResponse__getAttributionToken__) are set in the response. |
| `↳ next_page_token` | `string` A token that can be sent as [SearchRequest.page_token](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchRequest#_Google_Cloud_DiscoveryEngine_V1_SearchRequest__getPageToken__) to retrieve the next page. If this field is omitted, there are no subsequent pages. |
| `↳ 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. |
| `↳ summary` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.Summary` A summary as part of the search results. This field is only returned if [SearchRequest.ContentSearchSpec.summary_spec](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchRequest.ContentSearchSpec#_Google_Cloud_DiscoveryEngine_V1_SearchRequest_ContentSearchSpec__getSummarySpec__) is set. |
| `↳ query_expansion_info` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.QueryExpansionInfo` Query expansion information for the returned results. |
| `↳ natural_language_query_understanding_info` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.NaturalLanguageQueryUnderstandingInfo` Output only. Natural language query understanding information for the returned results. |
| `↳ session_info` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.SessionInfo` Session information. Only set if [SearchRequest.session](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchRequest#_Google_Cloud_DiscoveryEngine_V1_SearchRequest__getSession__) is provided. See its description for more details. |
| `↳ search_link_promotions` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchLinkPromotion>` Promotions for site search. |
| `↳ semantic_state` | `int` Output only. Indicates the semantic state of the search response. |

### getResults

A list of matched documents. 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-discoveryengine/latest/V1.SearchResponse.SearchResult>` |   |

### setResults

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.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-discoveryengine/latest/V1.SearchResponse.Facet>` |   |

### setFacets

Results of facets requested by user.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.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-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_SearchResponse__getResults__)
returned by pagination may be less than the
[total_size](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_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-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_SearchResponse__getResults__)
returned by pagination may be less than the
[total_size](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_SearchResponse__getTotalSize__)
that matches.

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

| **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-discoveryengine/latest/V1.UserEvent) logs resulting from
this search, which enables accurate attribution of search model
performance. This also helps to identify a request during the customer
support scenarios.

| **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-discoveryengine/latest/V1.UserEvent) logs resulting from
this search, which enables accurate attribution of search model
performance. This also helps to identify a request during the customer
support scenarios.

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

| **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-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_SearchResponse__getRedirectUri__)
and
[attribution_token](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_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-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_SearchResponse__getRedirectUri__)
and
[attribution_token](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse#_Google_Cloud_DiscoveryEngine_V1_SearchResponse__getAttributionToken__)
are set in the response.

| **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-discoveryengine/latest/V1.SearchRequest#_Google_Cloud_DiscoveryEngine_V1_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-discoveryengine/latest/V1.SearchRequest#_Google_Cloud_DiscoveryEngine_V1_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` |   |

### 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` |   |

### getSummary

A summary as part of the search results.

This field is only returned if
[SearchRequest.ContentSearchSpec.summary_spec](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchRequest.ContentSearchSpec#_Google_Cloud_DiscoveryEngine_V1_SearchRequest_ContentSearchSpec__getSummarySpec__)
is set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.Summary|null` |   |

### hasSummary

### clearSummary

### setSummary

A summary as part of the search results.

This field is only returned if
[SearchRequest.ContentSearchSpec.summary_spec](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchRequest.ContentSearchSpec#_Google_Cloud_DiscoveryEngine_V1_SearchRequest_ContentSearchSpec__getSummarySpec__)
is set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.Summary` |

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

### getQueryExpansionInfo

Query expansion information for the returned results.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.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-discoveryengine/latest/V1.SearchResponse.QueryExpansionInfo` |

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

### getNaturalLanguageQueryUnderstandingInfo

Output only. Natural language query understanding information for the
returned results.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.NaturalLanguageQueryUnderstandingInfo|null` |   |

### hasNaturalLanguageQueryUnderstandingInfo

### clearNaturalLanguageQueryUnderstandingInfo

### setNaturalLanguageQueryUnderstandingInfo

Output only. Natural language query understanding information for the
returned results.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.NaturalLanguageQueryUnderstandingInfo` |

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

### getSessionInfo

Session information.

Only set if
[SearchRequest.session](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchRequest#_Google_Cloud_DiscoveryEngine_V1_SearchRequest__getSession__)
is provided. See its description for more details.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.SessionInfo|null` |   |

### hasSessionInfo

### clearSessionInfo

### setSessionInfo

Session information.

Only set if
[SearchRequest.session](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchRequest#_Google_Cloud_DiscoveryEngine_V1_SearchRequest__getSession__)
is provided. See its description for more details.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.SessionInfo` |

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

### getSearchLinkPromotions

Promotions for site search.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchLinkPromotion>` |   |

### setSearchLinkPromotions

Promotions for site search.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchLinkPromotion>` |

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

### getSemanticState

Output only. Indicates the semantic state of the search response.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [SemanticState](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.SemanticState). |

### setSemanticState

Output only. Indicates the semantic state of the search response.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [SemanticState](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse.SemanticState). |

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