Files
Messenger/docs/adr/0003-search-ILIKE.md
vantablackTea 6fc6d977bf
CI / Go (build + vet + test) (push) Canceled after 0s
CI / Web (build + lint) (push) Canceled after 0s
added media fixes, search, push updates, pwa, metrics. preparing release 1.0
2026-09-27 23:26:15 +03:00

795 B

ADR 0003: Search via ILIKE instead of pg_trgm

  • Status: accepted
  • Date: 2026-09

Context

Message search must find substring matches across a user's conversations. pg_trgm + GIN gives indexed trigram search, but the extension is not installed on the target system and cannot be created by a non-superuser role (and adding it to the Docker image is an OS-level dependency).

Decision

Search with body ILIKE '%term%' restricted to the user's conversations, ordered by message id descending with a limit.

Consequences

  • No extension or superuser requirement; works on any PostgreSQL install.
  • Sequential scan is instant for thousands of messages (family scale).
  • Scaling path documented: CREATE EXTENSION pg_trgm + GIN index with gin_trgm_ops, keeping the same SQL semantics.