#[non_exhaustive]pub struct Chunk {
pub name: String,
pub id: String,
pub content: String,
pub relevance_score: Option<f64>,
pub document_metadata: Option<DocumentMetadata>,
pub derived_struct_data: Option<Struct>,
pub page_span: Option<PageSpan>,
pub chunk_metadata: Option<Box<ChunkMetadata>>,
pub data_urls: Vec<String>,
pub annotation_contents: Vec<String>,
pub annotation_metadata: Vec<AnnotationMetadata>,
/* private fields */
}conversational-search-service or search-service only.Expand description
Chunk captures all raw metadata information of items to be recommended or searched in the chunk mode.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringThe 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: StringUnique chunk ID of the current chunk.
content: StringContent is a string from a document (parsed content).
relevance_score: Option<f64>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.
document_metadata: Option<DocumentMetadata>Metadata of the document from the current chunk.
derived_struct_data: Option<Struct>Output only. This field is OUTPUT_ONLY. It contains derived data that are not in the original input document.
page_span: Option<PageSpan>Page span of the chunk.
chunk_metadata: Option<Box<ChunkMetadata>>Output only. Metadata of the current chunk.
data_urls: Vec<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:[<mediatype>][;base64],<data>
annotation_contents: Vec<String>Output only. Annotation contents if the current chunk contains annotations.
annotation_metadata: Vec<AnnotationMetadata>Output only. The annotation metadata includes structured content in the current chunk.
Implementations§
Source§impl Chunk
impl Chunk
pub fn new() -> Self
Sourcepub fn set_content<T: Into<String>>(self, v: T) -> Self
pub fn set_content<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_relevance_score<T>(self, v: T) -> Self
pub fn set_relevance_score<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_relevance_score<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_relevance_score<T>(self, v: Option<T>) -> Self
Sets or clears the value of relevance_score.
§Example
let x = Chunk::new().set_or_clear_relevance_score(Some(42.0));
let x = Chunk::new().set_or_clear_relevance_score(None::<f32>);Sourcepub fn set_document_metadata<T>(self, v: T) -> Selfwhere
T: Into<DocumentMetadata>,
pub fn set_document_metadata<T>(self, v: T) -> Selfwhere
T: Into<DocumentMetadata>,
Sets the value of document_metadata.
§Example
use google_cloud_discoveryengine_v1::model::chunk::DocumentMetadata;
let x = Chunk::new().set_document_metadata(DocumentMetadata::default()/* use setters */);Sourcepub fn set_or_clear_document_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<DocumentMetadata>,
pub fn set_or_clear_document_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<DocumentMetadata>,
Sets or clears the value of document_metadata.
§Example
use google_cloud_discoveryengine_v1::model::chunk::DocumentMetadata;
let x = Chunk::new().set_or_clear_document_metadata(Some(DocumentMetadata::default()/* use setters */));
let x = Chunk::new().set_or_clear_document_metadata(None::<DocumentMetadata>);Sourcepub fn set_derived_struct_data<T>(self, v: T) -> Self
pub fn set_derived_struct_data<T>(self, v: T) -> Self
Sets the value of derived_struct_data.
§Example
use wkt::Struct;
let x = Chunk::new().set_derived_struct_data(Struct::default()/* use setters */);Sourcepub fn set_or_clear_derived_struct_data<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_derived_struct_data<T>(self, v: Option<T>) -> Self
Sets or clears the value of derived_struct_data.
§Example
use wkt::Struct;
let x = Chunk::new().set_or_clear_derived_struct_data(Some(Struct::default()/* use setters */));
let x = Chunk::new().set_or_clear_derived_struct_data(None::<Struct>);Sourcepub fn set_page_span<T>(self, v: T) -> Self
pub fn set_page_span<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_page_span<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_page_span<T>(self, v: Option<T>) -> Self
Sourcepub fn set_chunk_metadata<T>(self, v: T) -> Selfwhere
T: Into<ChunkMetadata>,
pub fn set_chunk_metadata<T>(self, v: T) -> Selfwhere
T: Into<ChunkMetadata>,
Sets the value of chunk_metadata.
§Example
use google_cloud_discoveryengine_v1::model::chunk::ChunkMetadata;
let x = Chunk::new().set_chunk_metadata(ChunkMetadata::default()/* use setters */);Sourcepub fn set_or_clear_chunk_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<ChunkMetadata>,
pub fn set_or_clear_chunk_metadata<T>(self, v: Option<T>) -> Selfwhere
T: Into<ChunkMetadata>,
Sets or clears the value of chunk_metadata.
§Example
use google_cloud_discoveryengine_v1::model::chunk::ChunkMetadata;
let x = Chunk::new().set_or_clear_chunk_metadata(Some(ChunkMetadata::default()/* use setters */));
let x = Chunk::new().set_or_clear_chunk_metadata(None::<ChunkMetadata>);Sourcepub fn set_data_urls<T, V>(self, v: T) -> Self
pub fn set_data_urls<T, V>(self, v: T) -> Self
Sourcepub fn set_annotation_contents<T, V>(self, v: T) -> Self
pub fn set_annotation_contents<T, V>(self, v: T) -> Self
Sets the value of annotation_contents.
§Example
let x = Chunk::new().set_annotation_contents(["a", "b", "c"]);Sourcepub fn set_annotation_metadata<T, V>(self, v: T) -> Self
pub fn set_annotation_metadata<T, V>(self, v: T) -> Self
Sets the value of annotation_metadata.
§Example
use google_cloud_discoveryengine_v1::model::chunk::AnnotationMetadata;
let x = Chunk::new()
.set_annotation_metadata([
AnnotationMetadata::default()/* use setters */,
AnnotationMetadata::default()/* use (different) setters */,
]);