Public read API for documents.
Lets host apps build admin surfaces (list a collection's documents, show ingestion status, paginate) and assert on ingestion outcomes in tests without querying Arcana's schemas through Ecto directly.
Arcana.Document is the stable public shape: id, status,
chunk_count, metadata, source_id, content_type, timestamps,
and the preloaded collection.
Summary
Functions
Counts documents matching the same filters as list_documents/1
(:collection, :status, :source_id), for building pagination.
Fetches a single document by id, with its collection preloaded.
Lists documents, newest first.
Functions
Counts documents matching the same filters as list_documents/1
(:collection, :status, :source_id), for building pagination.
Examples
{:ok, total} = Arcana.count_documents(repo: MyApp.Repo, collection: "products")
Fetches a single document by id, with its collection preloaded.
Returns {:ok, document} or {:error, :not_found}.
Options
:repo- The Ecto repo to use (required unless configured globally)
Examples
{:ok, document} = Arcana.get_document(id, repo: MyApp.Repo)
Lists documents, newest first.
Options
:repo- The Ecto repo to use (required unless configured globally):collection- Filter by collection name. A name that doesn't exist matches nothing.:status- Filter by status (:pending,:processing,:completed,:failed):source_id- Filter by source id:limit- Maximum documents to return (default: 50):offset- Number of documents to skip (default: 0)
Examples
{:ok, docs} = Arcana.list_documents(repo: MyApp.Repo, collection: "products")
{:ok, failed} = Arcana.list_documents(repo: MyApp.Repo, status: :failed)
{:ok, page2} = Arcana.list_documents(repo: MyApp.Repo, limit: 20, offset: 20)