# Google Cloud Discovery Engine V1 Client - Class Chunk (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 Chunk.

Chunk captures all raw metadata information of items to be recommended or
searched in the chunk mode.

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

## Namespace

Google \\ Cloud \\ DiscoveryEngine \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` The full resource name of the chunk. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}/chunks/{chunk_id}`. This field must be a UTF-8 encoded string with a length limit of 1024 characters. |
| `↳ id` | `string` Unique chunk ID of the current chunk. |
| `↳ content` | `string` Content is a string from a document (parsed content). |
| `↳ relevance_score` | `float` Output only. Represents the relevance score based on similarity. Higher score indicates higher chunk relevance. The score is in range \[-1.0, 1.0\]. Only populated on [SearchResponse](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse). |
| `↳ document_metadata` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Chunk.DocumentMetadata` Metadata of the document from the current chunk. |
| `↳ derived_struct_data` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Struct` Output only. This field is OUTPUT_ONLY. It contains derived data that are not in the original input document. |
| `↳ page_span` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Chunk.PageSpan` Page span of the chunk. |
| `↳ chunk_metadata` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Chunk.ChunkMetadata` Output only. Metadata of the current chunk. |
| `↳ data_urls` | `string[]` Output only. Image Data URLs if the current chunk contains images. Data URLs are composed of four parts: a prefix (data:), a MIME type indicating the type of data, an optional base64 token if non-textual, and the data itself: data:\[ |
| `↳ annotation_contents` | `string[]` Output only. Annotation contents if the current chunk contains annotations. |
| `↳ annotation_metadata` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Chunk.AnnotationMetadata>` Output only. The annotation metadata includes structured content in the current chunk. |

### getName

The full resource name of the chunk.

Format:
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}/chunks/{chunk_id}`.
This field must be a UTF-8 encoded string with a length limit of 1024
characters.

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

### setName

The full resource name of the chunk.

Format:
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}/chunks/{chunk_id}`.
This field must be a UTF-8 encoded string with a length limit of 1024
characters.

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

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

### getId

Unique chunk ID of the current chunk.

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

### setId

Unique chunk ID of the current chunk.

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

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

### getContent

Content is a string from a document (parsed content).

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

### setContent

Content is a string from a document (parsed content).

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

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

### getRelevanceScore

Output only. Represents the relevance score based on similarity.

Higher score indicates higher chunk relevance.
The score is in range \[-1.0, 1.0\].
Only populated on
[SearchResponse](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasRelevanceScore

### clearRelevanceScore

### setRelevanceScore

Output only. Represents the relevance score based on similarity.

Higher score indicates higher chunk relevance.
The score is in range \[-1.0, 1.0\].
Only populated on
[SearchResponse](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse).

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

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

### getDocumentMetadata

Metadata of the document from the current chunk.

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

### hasDocumentMetadata

### clearDocumentMetadata

### setDocumentMetadata

Metadata of the document from the current chunk.

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

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

### getDerivedStructData

Output only. This field is OUTPUT_ONLY.

It contains derived data that are not in the original input document.

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

### hasDerivedStructData

### clearDerivedStructData

### setDerivedStructData

Output only. This field is OUTPUT_ONLY.

It contains derived data that are not in the original input document.

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

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

### getPageSpan

Page span of the chunk.

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

### hasPageSpan

### clearPageSpan

### setPageSpan

Page span of the chunk.

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

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

### getChunkMetadata

Output only. Metadata of the current chunk.

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

### hasChunkMetadata

### clearChunkMetadata

### setChunkMetadata

Output only. Metadata of the current chunk.

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

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

### getDataUrls

Output only. Image Data URLs if the current chunk contains images.

Data URLs are composed of four parts: a prefix (data:), a MIME type
indicating the type of data, an optional base64 token if non-textual,
and the data itself:
data:\[


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

### setDataUrls

Output only. Image Data URLs if the current chunk contains images.

Data URLs are composed of four parts: a prefix (data:), a MIME type
indicating the type of data, an optional base64 token if non-textual,
and the data itself:
data:\[


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

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

### getAnnotationContents

Output only. Annotation contents if the current chunk contains annotations.

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

### setAnnotationContents

Output only. Annotation contents if the current chunk contains annotations.

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

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

### getAnnotationMetadata

Output only. The annotation metadata includes structured content in the
current chunk.

| **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.Chunk.AnnotationMetadata>` |   |

### setAnnotationMetadata

Output only. The annotation metadata includes structured content in the
current chunk.

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

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