Text search using PostgreSQL
PostgreSQL comes with some nifty search features that go a long way and are often overlooked in favor of dedicated search systems.
In short:
- for simple search use cases, use the
LIKE
operator. Optionally add abtree
index for speed improvements - for more complex queries, fuzzy, partial matching, use
trigram
based search, via thepg_trgm
extension - for long texts and powerful ranking and advanced language processing features use
full text search