Full-Text Search Introduction (tsvector, to_tsquery)
Index documents with tsvector, run natural-language queries with to_tsquery, and rank results with ts_rank.
Why Full-Text Search?
LIKE/ILIKE finds substrings. Full-text search (FTS) understands words: stemming, stop words, language rules, ranked relevance. Built into PostgreSQL — no extension needed.
Two Core Types
FTS rests on two types:
tsvector— a parsed document: lexemes + positionstsquery— a parsed query: lexemes + boolean operators
You match them with the @@ operator.
All lessons in this course
- Concatenation: || and CONCAT
- UPPER, LOWER, SUBSTRING, REPLACE
- TRIM, LPAD, RPAD
- Full-Text Search Introduction (tsvector, to_tsquery)