Superseded by 0089: search is written fresh with
Pro engine drivers and queue-job indexing; decisions 1, 2, 5 and 6 carry forward there.
Context
0011 defers a dedicated search service (Typesense, Meilisearch, OpenSearch) and names Postgrespg_trgm and full-text search behind a search interface as the substitute. That interface does not exist yet.
Defining it now conflicts with nothing: the engines stay deferred, and this ADR only fixes the seam so a later engine is a new
driver, not a rewrite. Models opt in to search through 0046.
Decision
@stackra/searchdefines a driver interface, following the repository’s driver pattern: configuration selects a default driver and named instances.- The Postgres driver is the only driver built first, using
pg_trgmand full-text search. - Meilisearch and OpenSearch drivers are not built. They remain deferred per 0011 and need that row’s revival trigger. Typesense is not planned.
- Indexing is event-driven. A searchable model publishes events; an indexer consumes them and updates the driver’s index. Services never write an index directly.
- Every driver must pass one conformance suite shipped with the package, run against the Postgres driver now and any later driver.
- Search results respect tenancy: every query is scoped by tenant (0045).
Consequences
- A later engine is additive: a driver and a passing suite.
- The interface must be general enough for an external engine while only one backend proves it; expect a revision when the second driver arrives.
- Eventual consistency between a write and its appearance in search.
Enforcement
Planned — the conformance suite in the package’s__tests__ folder, run by its test task. Nothing is implemented yet.