PaveDBClient.Collection (pavedb_client v0.1.0)

Copy Markdown

Tenant-scoped collection handle.

Every function here forwards to its PaveDBClient counterpart with the tenant and collection the handle already carries. Build one with PaveDBClient.collection/3 or PaveDBClient.create_collection/3.

Summary

Functions

Adds one raw text document. Takes :docid and :metadata.

Adds several documents in one request.

Adds one precomputed embedding. Takes :docid and :metadata.

Deletes one document by id, along with its chunks.

Fetches the collection's settings plus document and chunk counts.

Fetches one document by id, with its metadata and chunk ids.

Fetches one chunk's record by its rid.

Fetches one chunk's raw text as %{"content" => text, "content_type" => type}.

Fetches one logged search, including the result ids it returned.

Uploads a local file. Takes :docid, :metadata, :content_type, and :csv_options.

Lists the chunks a document was split into. Listings carry no chunk text.

Lists the collection's documents.

Lists logged searches, newest first. Takes :limit and :offset.

Searches and returns just the matches, skipping the response envelope.

Renames the collection and returns a handle pointing at the new slug.

Replays one logged search against the collection's current data.

Searches by text and returns the full response envelope.

Searches with a precomputed query vector. Takes the same options as search/3.

Updates editable metadata. Takes :display_name.

Types

t()

@type t() :: %PaveDBClient.Collection{
  client: PaveDBClient.Client.t(),
  name: String.t(),
  tenant: String.t()
}

Functions

add(collection, text, opts \\ [])

@spec add(t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, PaveDBClient.Error.t()}

Adds one raw text document. Takes :docid and :metadata.

add_many(collection, documents)

@spec add_many(t(), list()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}

Adds several documents in one request.

The response reports per-document results, so a {:ok, _} can still carry individual failures under "documents".

add_vector(collection, vector, opts \\ [])

@spec add_vector(t(), [number()], keyword()) ::
  {:ok, map()} | {:error, PaveDBClient.Error.t()}

Adds one precomputed embedding. Takes :docid and :metadata.

delete(collection, docid)

@spec delete(t(), String.t()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}

Deletes one document by id, along with its chunks.

detail(collection)

@spec detail(t()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}

Fetches the collection's settings plus document and chunk counts.

get(collection, docid)

@spec get(t(), String.t()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}

Fetches one document by id, with its metadata and chunk ids.

get_chunk(collection, rid)

@spec get_chunk(t(), String.t()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}

Fetches one chunk's record by its rid.

get_chunk_content(collection, rid)

@spec get_chunk_content(t(), String.t()) ::
  {:ok, map()} | {:error, PaveDBClient.Error.t()}

Fetches one chunk's raw text as %{"content" => text, "content_type" => type}.

get_query(collection, query_id)

@spec get_query(t(), String.t()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}

Fetches one logged search, including the result ids it returned.

ingest(collection, path, opts \\ [])

@spec ingest(t(), Path.t(), keyword()) ::
  {:ok, map()} | {:error, PaveDBClient.Error.t()}

Uploads a local file. Takes :docid, :metadata, :content_type, and :csv_options.

list_chunks(collection, docid)

@spec list_chunks(t(), String.t()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}

Lists the chunks a document was split into. Listings carry no chunk text.

list_documents(collection)

@spec list_documents(t()) :: {:ok, [map()]} | {:error, PaveDBClient.Error.t()}

Lists the collection's documents.

list_queries(collection, opts \\ [])

@spec list_queries(
  t(),
  keyword()
) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}

Lists logged searches, newest first. Takes :limit and :offset.

matches(collection, q, opts \\ [])

@spec matches(t(), String.t(), keyword()) ::
  {:ok, [map()]} | {:error, PaveDBClient.Error.t()}

Searches and returns just the matches, skipping the response envelope.

rename(collection, new_name)

@spec rename(t(), String.t()) :: {:ok, t()} | {:error, PaveDBClient.Error.t()}

Renames the collection and returns a handle pointing at the new slug.

The original handle still carries the old name, so keep the returned one.

replay_query(collection, query_id)

@spec replay_query(t(), String.t()) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}

Replays one logged search against the collection's current data.

Compare the replayed ids with the stored ones to detect drift.

search(collection, q, opts \\ [])

@spec search(t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, PaveDBClient.Error.t()}

Searches by text and returns the full response envelope.

Takes :k, :filters, and :include_common. Use matches/3 for the hits alone.

search_vector(collection, vector, opts \\ [])

@spec search_vector(t(), [number()], keyword()) ::
  {:ok, map()} | {:error, PaveDBClient.Error.t()}

Searches with a precomputed query vector. Takes the same options as search/3.

update(collection, opts \\ [])

@spec update(
  t(),
  keyword()
) :: {:ok, map()} | {:error, PaveDBClient.Error.t()}

Updates editable metadata. Takes :display_name.