Build powerful search features with native full-text search, ranking, highlighting, and fuzzy matching.
Prax provides a unified API for full-text search across all supported databases, from PostgreSQL's powerful tsvector to MongoDB Atlas Search.
| Feature | PostgreSQL | MySQL | SQLite | MSSQL | MongoDB |
|---|---|---|---|---|---|
| Full-Text Index | ✅ tsvector/GIN | ✅ FULLTEXT | ✅ FTS5 | ✅ Full-Text | ✅ Atlas Search |
| Relevance Ranking | ✅ ts_rank | ✅ | ✅ bm25 | ✅ RANK | ✅ score |
| Highlighting | ✅ ts_headline | ❌ | ✅ | ❌ | ✅ |
| Fuzzy Search | ✅ pg_trgm | ❌ | ❌ | ✅ SOUNDEX | ✅ |
| Faceted Search | ✅ | ❌ | ❌ | ❌ | ✅ |
Use SearchQuery for simple text search.
Weight columns differently and sort by relevance score.
Show users where their search terms matched in the results.
Handle typos and spelling variations with fuzzy matching.
Search for exact phrases or use boolean operators.
Full-text search requires proper indexes for performance.
Powerful full-text search with Atlas Search, including facets, fuzzy matching, and scoring.
Note: Atlas Search requires MongoDB Atlas (not available on self-hosted). Create indexes in the Atlas UI or via the Admin API.
Define full-text indexes in your schema and migrations.
GIN indexes are faster for lookups but slower to update. Use GiST indexes if you have frequent writes and can tolerate slower searches.
Store a computed tsvector column instead of generating it at query time. Update it via triggers when the source columns change.
Full-text search can return many results. Always use LIMIT and implement pagination to avoid performance issues.
For complex search requirements, consider Elasticsearch, Meilisearch, or Typesense. Database full-text search is great for basic to moderate needs.