Menu

Postgres full-text search is enough for most side projects
📰

Postgres full-text search is enough for most side projects

DEV Community: postgres·Hayden Carter·17 days ago
#6MDbKwm2
#devtopostgresql#devto#dev#search#keep
Reading 0:00
15s threshold

Hayden Carter

I keep reaching for a search service and then remembering Postgres already has one.

A tsvector column, a GIN index, and a trigger to keep it current gets you:

  • stemmed matches (search "deploying" finds "deploy")
  • ranking with ts_rank
  • phrase queries with phraseto_tsquery
  • zero extra infrastructure

The gotchas are worth knowing: configuration matters for language, weight classes let you boost titles, and you'll want a custom dictionary if your domain has product names that shouldn't be stemmed.

Where it stops being enough: fuzzy matching on typos, per-field highlighting at scale, and multi-language relevance that changes with the query. That's when you move.

Until then, the search box is 30 lines of SQL and a migration.

What's the smallest thing that made you switch to a real search engine?