# Google Cloud Dialogflow V2 Client - Class SearchKnowledgeRequest (2.4.0)

2.4.0 (latest) 2.3.1 2.2.1 2.1.2 2.0.1 1.17.2 1.16.0 1.15.1 1.14.0 1.13.0 1.12.3 1.11.0 1.10.2 1.9.0 1.8.0 1.7.2 1.6.0 1.5.0 1.4.0 1.3.2 1.2.0 1.1.1 1.0.1 Reference documentation and code samples for the Google Cloud Dialogflow V2 Client class SearchKnowledgeRequest.

The request message for
[Conversations.SearchKnowledge](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Client.ConversationsClient#_Google_Cloud_Dialogflow_V2_Client_ConversationsClient__searchKnowledge__).

Generated from protobuf message `google.cloud.dialogflow.v2.SearchKnowledgeRequest`

## Namespace

Google \\ Cloud \\ Dialogflow \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ parent` | `string` Required. The parent resource contains the conversation profile Format: 'projects/ |
| `↳ query` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.TextInput` Required. The natural language text query for knowledge search. |
| `↳ conversation_profile` | `string` Required. The conversation profile used to configure the search. Format: `projects/<Project ID>/locations/<Location ID>/conversationProfiles/<Conversation Profile ID>`. |
| `↳ session_id` | `string` Required. The ID of the search session. The session_id can be combined with Dialogflow V3 Agent ID retrieved from conversation profile or on its own to identify a search session. The search history of the same session will impact the search result. It's up to the API caller to choose an appropriate `Session ID`. It can be a random number or some type of session identifiers (preferably hashed). The length must not exceed 36 characters. |
| `↳ conversation` | `string` Optional. The conversation (between human agent and end user) where the search request is triggered. Format: `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>`. |
| `↳ latest_message` | `string` Optional. The name of the latest conversation message when the request is triggered. Format: `projects/<Project ID>/locations/<Location ID>/conversations/<Conversation ID>/messages/<Message ID>`. |
| `↳ query_source` | `int` Optional. The source of the query in the request. |
| `↳ end_user_metadata` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Struct` Optional. Information about the end-user to improve the relevance and accuracy of generative answers. This will be interpreted and used by a language model, so, for good results, the data should be self-descriptive, and in a simple structure. Example: `json { "subscription plan": "Business Premium Plus", "devices owned": [ {"model": "Google Pixel 7"}, {"model": "Google Pixel Tablet"} ] }` |
| `↳ search_config` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.SearchKnowledgeRequest.SearchConfig` Optional. Configuration specific to search queries with data stores. |
| `↳ exact_search` | `bool` Optional. Whether to search the query exactly without query rewrite. |

### getParent

Required. The parent resource contains the conversation profile
Format: 'projects/


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

### setParent

Required. The parent resource contains the conversation profile
Format: 'projects/


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

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

### getQuery

Required. The natural language text query for knowledge search.

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

### hasQuery

### clearQuery

### setQuery

Required. The natural language text query for knowledge search.

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

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

### getConversationProfile

Required. The conversation profile used to configure the search.

Format: `projects/<Project ID>/locations/<Location
ID>/conversationProfiles/<Conversation Profile ID>`.

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

### setConversationProfile

Required. The conversation profile used to configure the search.

Format: `projects/<Project ID>/locations/<Location
ID>/conversationProfiles/<Conversation Profile ID>`.

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

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

### getSessionId

Required. The ID of the search session.

The session_id can be combined with Dialogflow V3 Agent ID retrieved from
conversation profile or on its own to identify a search session. The search
history of the same session will impact the search result. It's up to the
API caller to choose an appropriate `Session ID`. It can be a random number
or some type of session identifiers (preferably hashed). The length must
not exceed 36 characters.

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

### setSessionId

Required. The ID of the search session.

The session_id can be combined with Dialogflow V3 Agent ID retrieved from
conversation profile or on its own to identify a search session. The search
history of the same session will impact the search result. It's up to the
API caller to choose an appropriate `Session ID`. It can be a random number
or some type of session identifiers (preferably hashed). The length must
not exceed 36 characters.

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

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

### getConversation

Optional. The conversation (between human agent and end user) where the
search request is triggered. Format: `projects/<Project
ID>/locations/<Location ID>/conversations/<Conversation ID>`.

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

### setConversation

Optional. The conversation (between human agent and end user) where the
search request is triggered. Format: `projects/<Project
ID>/locations/<Location ID>/conversations/<Conversation ID>`.

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

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

### getLatestMessage

Optional. The name of the latest conversation message when the request is
triggered.

Format: `projects/<Project ID>/locations/<Location
ID>/conversations/<Conversation ID>/messages/<Message ID>`.

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

### setLatestMessage

Optional. The name of the latest conversation message when the request is
triggered.

Format: `projects/<Project ID>/locations/<Location
ID>/conversations/<Conversation ID>/messages/<Message ID>`.

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

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

### getQuerySource

Optional. The source of the query in the request.

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

### setQuerySource

Optional. The source of the query in the request.

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

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

### getEndUserMetadata

Optional. Information about the end-user to improve the relevance and
accuracy of generative answers.

This will be interpreted and used by a language model, so, for good
results, the data should be self-descriptive, and in a simple structure.
Example:

    {
      "subscription plan": "Business Premium Plus",
      "devices owned": [
        {"model": "Google Pixel 7"},
        {"model": "Google Pixel Tablet"}
      ]
    }

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

### hasEndUserMetadata

### clearEndUserMetadata

### setEndUserMetadata

Optional. Information about the end-user to improve the relevance and
accuracy of generative answers.

This will be interpreted and used by a language model, so, for good
results, the data should be self-descriptive, and in a simple structure.
Example:

    {
      "subscription plan": "Business Premium Plus",
      "devices owned": [
        {"model": "Google Pixel 7"},
        {"model": "Google Pixel Tablet"}
      ]
    }

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

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

### getSearchConfig

Optional. Configuration specific to search queries with data stores.

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

### hasSearchConfig

### clearSearchConfig

### setSearchConfig

Optional. Configuration specific to search queries with data stores.

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

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

### getExactSearch

Optional. Whether to search the query exactly without query rewrite.

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

### setExactSearch

Optional. Whether to search the query exactly without query rewrite.

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

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