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 messagegoogle.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 onSearchResponse.
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
array
Output only. Annotation contents if the current chunk contains annotations.
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 onSearchResponse.
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 onSearchResponse.
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:[
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Discovery Engine V1 Client - Class Chunk (1.7.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.7.0 (latest)](/php/docs/reference/cloud-discoveryengine/latest/V1.Chunk)\n- [1.6.1](/php/docs/reference/cloud-discoveryengine/1.6.1/V1.Chunk)\n- [1.5.1](/php/docs/reference/cloud-discoveryengine/1.5.1/V1.Chunk)\n- [1.4.0](/php/docs/reference/cloud-discoveryengine/1.4.0/V1.Chunk)\n- [1.3.3](/php/docs/reference/cloud-discoveryengine/1.3.3/V1.Chunk)\n- [1.2.0](/php/docs/reference/cloud-discoveryengine/1.2.0/V1.Chunk)\n- [1.1.0](/php/docs/reference/cloud-discoveryengine/1.1.0/V1.Chunk)\n- [1.0.0](/php/docs/reference/cloud-discoveryengine/1.0.0/V1.Chunk)\n- [0.11.3](/php/docs/reference/cloud-discoveryengine/0.11.3/V1.Chunk)\n- [0.8.0](/php/docs/reference/cloud-discoveryengine/0.8.0/V1.Chunk)\n- [0.7.1](/php/docs/reference/cloud-discoveryengine/0.7.1/V1.Chunk)\n- [0.6.0](/php/docs/reference/cloud-discoveryengine/0.6.0/V1.Chunk)\n- [0.5.0](/php/docs/reference/cloud-discoveryengine/0.5.0/V1.Chunk)\n- [0.4.0](/php/docs/reference/cloud-discoveryengine/0.4.0/V1.Chunk)\n- [0.3.0](/php/docs/reference/cloud-discoveryengine/0.3.0/V1.Chunk)\n- [0.2.0](/php/docs/reference/cloud-discoveryengine/0.2.0/V1.Chunk)\n- [0.1.1](/php/docs/reference/cloud-discoveryengine/0.1.1/V1.Chunk) \nReference documentation and code samples for the Google Cloud Discovery Engine V1 Client class Chunk.\n\nChunk captures all raw metadata information of items to be recommended or\nsearched in the chunk mode.\n\nGenerated from protobuf message `google.cloud.discoveryengine.v1.Chunk`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ DiscoveryEngine \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nThe full resource name of the chunk.\n\nFormat:\n`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}/chunks/{chunk_id}`.\nThis field must be a UTF-8 encoded string with a length limit of 1024\ncharacters.\n\n### setName\n\nThe full resource name of the chunk.\n\nFormat:\n`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document_id}/chunks/{chunk_id}`.\nThis field must be a UTF-8 encoded string with a length limit of 1024\ncharacters.\n\n### getId\n\nUnique chunk ID of the current chunk.\n\n### setId\n\nUnique chunk ID of the current chunk.\n\n### getContent\n\nContent is a string from a document (parsed content).\n\n### setContent\n\nContent is a string from a document (parsed content).\n\n### getRelevanceScore\n\nOutput only. Represents the relevance score based on similarity.\n\nHigher score indicates higher chunk relevance.\nThe score is in range \\[-1.0, 1.0\\].\nOnly populated on\n[SearchResponse](/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse).\n\n### hasRelevanceScore\n\n### clearRelevanceScore\n\n### setRelevanceScore\n\nOutput only. Represents the relevance score based on similarity.\n\nHigher score indicates higher chunk relevance.\nThe score is in range \\[-1.0, 1.0\\].\nOnly populated on\n[SearchResponse](/php/docs/reference/cloud-discoveryengine/latest/V1.SearchResponse).\n\n### getDocumentMetadata\n\nMetadata of the document from the current chunk.\n\n### hasDocumentMetadata\n\n### clearDocumentMetadata\n\n### setDocumentMetadata\n\nMetadata of the document from the current chunk.\n\n### getDerivedStructData\n\nOutput only. This field is OUTPUT_ONLY.\n\nIt contains derived data that are not in the original input document.\n\n### hasDerivedStructData\n\n### clearDerivedStructData\n\n### setDerivedStructData\n\nOutput only. This field is OUTPUT_ONLY.\n\nIt contains derived data that are not in the original input document.\n\n### getPageSpan\n\nPage span of the chunk.\n\n### hasPageSpan\n\n### clearPageSpan\n\n### setPageSpan\n\nPage span of the chunk.\n\n### getChunkMetadata\n\nOutput only. Metadata of the current chunk.\n\n### hasChunkMetadata\n\n### clearChunkMetadata\n\n### setChunkMetadata\n\nOutput only. Metadata of the current chunk.\n\n### getDataUrls\n\nOutput only. Image Data URLs if the current chunk contains images.\n\nData URLs are composed of four parts: a prefix (data:), a MIME type\nindicating the type of data, an optional base64 token if non-textual,\nand the data itself:\ndata:\\[\n\n\n### setDataUrls\n\nOutput only. Image Data URLs if the current chunk contains images.\n\nData URLs are composed of four parts: a prefix (data:), a MIME type\nindicating the type of data, an optional base64 token if non-textual,\nand the data itself:\ndata:\\[\n\n\n### getAnnotationContents\n\nOutput only. Annotation contents if the current chunk contains annotations.\n\n### setAnnotationContents\n\nOutput only. Annotation contents if the current chunk contains annotations.\n\n### getAnnotationMetadata\n\nOutput only. The annotation metadata includes structured content in the\ncurrent chunk.\n\n### setAnnotationMetadata\n\nOutput only. The annotation metadata includes structured content in the\ncurrent chunk."]]