document.ChunkedDocument

A document with an attached sequence of chunks.

Usage

Source

document.ChunkedDocument(
    content,
    origin=None,
    attributes=None,
    *,
    chunks,
)

This is the chunked variant of Document, the result of running a chunker over a document. It keeps all of the original Document fields (content, origin, attributes) and adds the chunks produced from that content. Stores accept a ChunkedDocument directly in upsert(). It is also a sequence: you can iterate over it, take its len(), and index into it to reach the underlying chunks.

Parameters

chunks: list[Chunk]
The chunks produced from this document’s content, in document order.

Methods

Name Description
from_any() Convert any chunked document-like object to a raghilda ChunkedDocument.

from_any()

Convert any chunked document-like object to a raghilda ChunkedDocument.

Usage

Source

from_any(doc)

Use Document.from_any() for unchunked inputs.