docarray.array.chunk module#

class docarray.array.chunk.ChunkArray(docs, reference_doc)[source]#

Bases: docarray.array.memory.DocumentArrayInMemory

ChunkArray inherits from DocumentArray. It’s a subset of Documents.

Parameters
  • docs – Set of sub-documents (i.e chunks) of reference_doc

  • reference_doc (Document) – Reference Document for the sub-documents

Set constructor method.

Parameters
  • doc_views – protobuf representation of the chunks

  • reference_doc (Document) – parent document

append(document)[source]#

Add a sub-document (i.e chunk) to the current Document.

Parameters

document (Document) – Sub-document to be appended

Note

Comparing to DocumentArray.append(), this method adds more safeguard to make sure the added chunk is legit.

property reference_doc: Document#

Get the document that ChunkArray belongs to.

Return type

Document

Returns

reference doc

property granularity: int#

Get granularity of all document in this array.

Return type

int

Returns

granularity

property adjacency: int#

Get adjacency of all document in this array.

Return type

int

Returns

adjacency