Full-Text Search: Lexemes, Tsvectors, and Stemming Mechanics

A deep dive into the internals of full-text search in relational databases, covering document normalization, dictionary-based stemming, and ranking algorithms like BM25.

Sample Questions

  1. What is a lexeme in the context of full-text search?

    • A word that has been normalized to its root form
    • A specific type of database index
    • The total number of words in a document
    • A query operator used for logical AND
  2. Which data type is used in PostgreSQL to store a preprocessed document for full-text search?

    • varchar
    • tsquery
    • text
    • tsvector
  3. What is the primary goal of a stemming algorithm?

    • To convert text into binary format
    • To reduce words to their base or root form
    • To count the frequency of characters
    • To translate text into multiple languages