类 Document
This is the core data structure for RAG operations. Each document contains metadata, an optional embedding vector, and an optional similarity score.
The document ID is automatically generated as a deterministic UUID based on the document metadata (doc_id, chunk_id, and content), ensuring consistent IDs for the same content across different runs.
-
构造器概要
构造器构造器说明Document(DocumentMetadata metadata) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Creates a new Document instance. -
方法概要
修饰符和类型方法说明double[]已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the embedding vector.getId()已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the document ID.已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the document metadata.已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the custom payload from document metadata.getPayloadValue(String key) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets a specific payload value by key.<T> TgetPayloadValueAs(String key, Class<T> targetClass) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets a specific payload value by key and converts it to the specified type.getScore()已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the similarity score.已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the document vector name.booleanhasPayloadKey(String key) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Checks if the document payload contains a specific key.voidsetEmbedding(double[] embedding) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Sets the embedding vector.void已过时, 待删除: 此 API 元素将从以后的版本中删除。Sets the similarity score.voidsetVectorName(String vectorName) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Sets the document vector name.toString()已过时, 待删除: 此 API 元素将从以后的版本中删除。
-
构造器详细资料
-
Document
已过时, 待删除: 此 API 元素将从以后的版本中删除。Creates a new Document instance.The document ID is automatically generated as a deterministic UUID based on the metadata (doc_id, chunk_id, and content).
- 参数:
metadata- the document metadata
-
-
方法详细资料
-
getId
已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the document ID.- 返回:
- the document ID (UUID string)
-
getMetadata
已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the document metadata.- 返回:
- the document metadata
-
getEmbedding
public double[] getEmbedding()已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the embedding vector.- 返回:
- the embedding vector, or null if not set
-
setEmbedding
public void setEmbedding(double[] embedding) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Sets the embedding vector.- 参数:
embedding- the embedding vector
-
getScore
已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the similarity score.- 返回:
- the similarity score, or null if not set
-
setScore
已过时, 待删除: 此 API 元素将从以后的版本中删除。Sets the similarity score.- 参数:
score- the similarity score
-
getPayload
已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the custom payload from document metadata.This is a convenience method that delegates to the metadata's getPayload(). The payload contains business-specific fields such as filename, department, author, tags, and other custom metadata.
- 返回:
- an unmodifiable map of custom metadata fields (never null)
-
getPayloadValue
已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets a specific payload value by key.This is a convenience method that delegates to the metadata's getPayloadValue(). Use this to retrieve individual payload values without accessing the entire map.
- 参数:
key- the payload key- 返回:
- the payload value, or null if the key doesn't exist
- 抛出:
NullPointerException- if key is null
-
getPayloadValueAs
已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets a specific payload value by key and converts it to the specified type.This method is useful when the payload contains complex objects (like custom POJOs) that were serialized to Map during storage. It uses Jackson's ObjectMapper to convert the Map back to the original type.
- 类型参数:
T- the target type- 参数:
key- the payload keytargetClass- the target class to convert to- 返回:
- the payload value converted to the specified type, or null if the key doesn't exist
- 抛出:
IllegalArgumentException- if the value cannot be converted to the target typeNullPointerException- if key or clazz is null
-
hasPayloadKey
已过时, 待删除: 此 API 元素将从以后的版本中删除。Checks if the document payload contains a specific key.This is a convenience method that delegates to the metadata's hasPayloadKey(). Use this to safely check for the existence of a payload field before retrieving it.
- 参数:
key- the payload key to check- 返回:
- true if the key exists in the payload, false otherwise
- 抛出:
NullPointerException- if key is null
-
getVectorName
已过时, 待删除: 此 API 元素将从以后的版本中删除。Gets the document vector name.- 返回:
- the document name, or null if not set
-
setVectorName
已过时, 待删除: 此 API 元素将从以后的版本中删除。Sets the document vector name.- 参数:
vectorName- the document name
-
toString
已过时, 待删除: 此 API 元素将从以后的版本中删除。
-