For apps under a few million rows, I keep reaching for Postgres search before adding a search service. My setup:
to_tsvector('english', title)andto_tsvector('english', body)with GIN expression indexes.websearch_to_tsqueryso users can type quotes and minus signs naturally.pg_trgmsimilarity as a fallback for typos when there are few results.ts_headlinefor snippets.
Pros: one database, transactional consistency, no sync jobs. Cons: relevance tuning is basic, and multilingual content is harder.
The trick that matters: your query must use exactly the same expression as the index, or Postgres won't use it.
ByteNomad Dev Studio · Next.js, Postgres, bots · milestone escrow
- Reacted by
