Skip to content
Theory · JSONB and Full-Text Search · lesson 11 of 13

Ranking, indexes and trigrams

Search over the reviews works, but it has three weak spots. The results come in no particular order, while the manager wants the best-matching reviews first. Every query builds the vector for every row anew. And full-text search does not forgive a typo such as capucino. Let's deal with all three.

In this lesson

  • Rank: ts_rank
  • A stored vector and a GIN index
  • Trigrams: pg_trgm
  • Common mistake
  • Key points