# Google Cloud Vector Search V1 Client - Class SemanticSearch (0.4.0)

0.4.0 (latest) 0.3.0 0.2.0 0.1.0 Reference documentation and code samples for the Google Cloud Vector Search V1 Client class SemanticSearch.

Defines a semantic search operation.

Generated from protobuf message `google.cloud.vectorsearch.v1.SemanticSearch`

## Namespace

Google \\ Cloud \\ VectorSearch \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ search_text` | `string` Required. The query text, which is used to generate an embedding according to the embedding model specified in the collection config. |
| `↳ search_field` | `string` Required. The vector field to search. |
| `↳ task_type` | `int` Required. The task type of the query embedding. |
| `↳ output_fields` | `https://docs.cloud.google.com/php/docs/reference/cloud-vectorsearch/latest/V1.OutputFields` Optional. The fields to return in the search results. |
| `↳ filter` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Struct` Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}}, represented as a google.protobuf.Struct. |
| `↳ top_k` | `int` Optional. The number of data objects to return. |
| `↳ search_hint` | `https://docs.cloud.google.com/php/docs/reference/cloud-vectorsearch/latest/V1.SearchHint` Optional. Sets the search hint. If no strategy is specified, the service will use an index if one is available, and fall back to KNN search otherwise. |

### getSearchText

Required. The query text, which is used to generate an embedding according
to the embedding model specified in the collection config.

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

### setSearchText

Required. The query text, which is used to generate an embedding according
to the embedding model specified in the collection config.

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

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

### getSearchField

Required. The vector field to search.

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

### setSearchField

Required. The vector field to search.

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

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

### getTaskType

Required. The task type of the query embedding.

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

### setTaskType

Required. The task type of the query embedding.

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

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

### getOutputFields

Optional. The fields to return in the search results.

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

### hasOutputFields

### clearOutputFields

### setOutputFields

Optional. The fields to return in the search results.

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

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

### getFilter

Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}},
represented as a google.protobuf.Struct.

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

### hasFilter

### clearFilter

### setFilter

Optional. A JSON filter expression, e.g. {"genre": {"$eq": "sci-fi"}},
represented as a google.protobuf.Struct.

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

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

### getTopK

Optional. The number of data objects to return.

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

### hasTopK

### clearTopK

### setTopK

Optional. The number of data objects to return.

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

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

### getSearchHint

Optional. Sets the search hint. If no strategy is specified, the service
will use an index if one is available, and fall back to KNN search
otherwise.

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

### hasSearchHint

### clearSearchHint

### setSearchHint

Optional. Sets the search hint. If no strategy is specified, the service
will use an index if one is available, and fall back to KNN search
otherwise.

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

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