Scrypath.Projection (scrypath v0.3.17)

Copy Markdown View Source

Document projection for schemas declared with use Scrypath.

Scrypath.Projection.document/2 projects the declared fields: [...] by default. When a schema exports search_document/1, that hook takes precedence and the document source becomes :custom.

Association-derived data requires explicit preload work before projection. Scrypath does not reach through unloaded associations or infer extra queries on behalf of the caller. Oban sync jobs load records themselves, so declare those associations with preload: on use Scrypath, or define search_records/2 (see Scrypath.Loader).

Summary

Functions

document(schema_module, source_record)

@spec document(module(), struct() | map()) :: Scrypath.Document.t()

document_source(schema_module)

@spec document_source(module()) :: :custom | :fields