DocumentArray
Another powerful concept in Jina is the DocumentArray, which is a list of Document objects. If you need multiple Documents, you can group them all together in a list using DocumentArray. You can use a DocumentArray as a regular list in Python with all of the usual methods, such as insert
, delete
, construct
, traverse
, and sort
. The DocumentArray is a first-class citizen to an Executor, serving as its input and output. We will talk about Executors in the next section, but for now, think of them as the way Jina processes Documents.
Constructing a DocumentArray
You can construct, delete, insert, sort, and traverse a DocumentArray
like a Python list. You can create these in different ways:
from jina import DocumentArray, Document documentarray = DocumentArray([Document(), Document()]) from jina import DocumentArray, Document documentarray = DocumentArray((Document() for _ in range(10)) from jina import DocumentArray, Document documentarray1 = DocumentArray((Document...