0Pricing
SQL Academy · Lesson

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 + positions
  • tsquery — a parsed query: lexemes + boolean operators

You match them with the @@ operator.

All lessons in this course

  1. Concatenation: || and CONCAT
  2. UPPER, LOWER, SUBSTRING, REPLACE
  3. TRIM, LPAD, RPAD
  4. Full-Text Search Introduction (tsvector, to_tsquery)
← Back to SQL Academy