# `Scrypath.Projection`
[🔗](https://github.com/szTheory/scrypath/blob/v0.3.17/lib/scrypath/projection.ex#L1)

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`).

# `document`

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

# `document_source`

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
