Scrypath.Backend behaviour (scrypath v0.3.4)

Copy Markdown View Source

Internal backend behavior for Scrypath runtime adapters.

This behavior is documented so architecture references remain valid, but it is still considered an internal seam for v1 rather than a stable extension API.

Summary

Callbacks

delete_documents(module, list, keyword)

@callback delete_documents(module(), [term()], keyword()) ::
  {:ok, term()} | {:error, term()}

index_name(module, keyword)

@callback index_name(
  module(),
  keyword()
) :: String.t()

name()

@callback name() :: atom()

search(module, t, keyword)

@callback search(module(), Scrypath.Query.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

search_many(list, keyword)

(optional)
@callback search_many(
  [{module(), Scrypath.Query.t()}],
  keyword()
) :: {:ok, map()} | {:error, term()}

Optional federated multi-search over multiple schemas in one HTTP round-trip.

Implementations return raw Meilisearch JSON maps (string keys) before the search layer decorates them into structs.

upsert_documents(module, list, keyword)

@callback upsert_documents(module(), [Scrypath.Document.t()], keyword()) ::
  {:ok, term()} | {:error, term()}