# search_ash v0.1.0 - Table of Contents

> Ash extension for multilingual full-text search: a `search do … end` DSL that auto-generates the tsvector index, keeps a stemmed column in sync, and exposes a tenant-aware, ranked `search` action. Built on search_core + the stemmers NIF.

## Modules

- [SearchAsh](SearchAsh.md): An Ash extension that adds multilingual full-text search to a resource with one
`search do … end` block.
- [SearchAsh.Changes.SyncSearchText](SearchAsh.Changes.SyncSearchText.md): Global change generated by `SearchAsh`. Keeps the `search_text` attribute in sync with
the configured `fields`, stemmed in the row's language via `SearchCore`.
- [SearchAsh.GlobalIndex](SearchAsh.GlobalIndex.md): Ash extension that turns a resource into a **unified, cross-entity search index** — one
row per indexed source object, searched with a single ranked query (Option B).
- [SearchAsh.GlobalIndex.Info](SearchAsh.GlobalIndex.Info.md): Read a resource's `global_index do … end` configuration.
- [SearchAsh.GlobalIndex.Preparations.GlobalSearch](SearchAsh.GlobalIndex.Preparations.GlobalSearch.md): Preparation for a `SearchAsh.GlobalIndex` resource's `:global_search` action. Hides
`archived` rows (unless `include_archived?: true`), filters on the tsvector match, and
ranks by `ts_rank` (prefix-aware, with a primary-key tiebreaker). A blank query lists
the matching rows, unranked.

- [SearchAsh.GlobalIndex.Transformers.AddActions](SearchAsh.GlobalIndex.Transformers.AddActions.md): Adds the `:upsert` action, the `:global_search` read action, the `:search_rank`
calculation, and default `:read`/`:destroy` actions to a `SearchAsh.GlobalIndex`
resource (each only if absent).

- [SearchAsh.GlobalIndex.Transformers.AddSchema](SearchAsh.GlobalIndex.Transformers.AddSchema.md): Adds the index columns, the `unique_source` identity (tenant-aware) and the GIN index
to a `SearchAsh.GlobalIndex` resource.

- [SearchAsh.Info](SearchAsh.Info.md): Read a resource's `search do … end` configuration.
- [SearchAsh.Preparations.Search](SearchAsh.Preparations.Search.md): Preparation generated by `SearchAsh` for the `:search` read action. Builds a
tsquery from the `query` + `language` arguments (same `SearchCore` pipeline used at
index time) and filters on the `'simple'` tsvector of the search-text column.

- [SearchAsh.Source](SearchAsh.Source.md): Ash extension that mirrors a resource into a `SearchAsh.GlobalIndex` so it shows up in
the unified global search.
- [SearchAsh.Source.Info](SearchAsh.Source.Info.md): Read a resource's `searchable do … end` configuration.
- [SearchAsh.Source.Transformers.AddSync](SearchAsh.Source.Transformers.AddSync.md): Adds the create/update sync change and the destroy remove change, and forces
`require_atomic? false` on every update/destroy action.
- [SearchAsh.Transformers.AddSearchAction](SearchAsh.Transformers.AddSearchAction.md): Adds the `:search` read action (query + language args) unless already defined.
- [SearchAsh.Transformers.AddSearchIndex](SearchAsh.Transformers.AddSearchIndex.md): Adds the GIN expression index `to_tsvector('simple', <search_text>)` to the resource's
Postgres `custom_indexes`, so migration generation emits and round-trips it. No-op for
resources that are not backed by AshPostgres.

- [SearchAsh.Transformers.AddSearchRank](SearchAsh.Transformers.AddSearchRank.md): Adds a `:search_rank` calculation (`ts_rank` over the search-text tsvector, taking the
built tsquery as an argument). The `:search` action loads and sorts by it. Skipped when
`rank?` is false or a `:search_rank` calculation already exists.

- [SearchAsh.Transformers.AddSearchTextAttribute](SearchAsh.Transformers.AddSearchTextAttribute.md): Adds the `search_text` string attribute unless the resource already defines it.
- [SearchAsh.Transformers.AddSyncChange](SearchAsh.Transformers.AddSyncChange.md): Adds the global change that keeps `search_text` in sync on create/update.

