- All Courses
- PostgreSQL for Application Developers
- Querying with Intent
- Full text search
Lesson 2.4
Full text search
PostgreSQL parses text into normalised lexemes, so a search for one word form matches the others and stop words are dropped.
5mIntermediate11.8k students
Overview
Search without another system
PostgreSQL parses text into normalised lexemes, so a search for one word form matches the others and stop words are dropped. For a great many applications that is enough, and one fewer system to operate is a real feature.
Store the search vector in a generated column and index it. Computing it per query means a full table scan and a lot of parsing on every search.
Relevance ranking weights matches by field and frequency, so a match in a title can outrank one buried in a body.
In this lesson you will:
- Turn text into a searchable vector
- Rank results by relevance
- Index the search column properly
Resources
Notes are not saved yet — they clear when you leave this page.
Previous Lesson
CTEs and subqueries
4m
How the query planner works
10m