Fulltext search

Fulltext search is a way to find documents by text content in a String or Utf8 column by words, phrases, and (with special indexing) by substrings. Unlike simple string predicates, fulltext search typically involves tokenization and normalization (for example, lowercasing), so queries operate on "terms" rather than raw byte substrings. Typical use cases include:

  • search in product catalogs and knowledge bases
  • log/message search
  • searching document metadata and descriptions

The core idea of a fulltext index is an inverted index: for each term, the index stores the list of documents (primary keys) that contain that term. This allows queries like "documents containing terms A and B" to avoid full table scans.

In YDB, fulltext search can be performed in two main ways:

  • without an index — by scanning the table and applying string predicates (for example, LIKE). This approach is simple but does not scale well as data grows.
  • with a fulltext index — by creating a fulltext index and executing queries through VIEW IndexName. This approach is designed for scalable search.

Fulltext search with a fulltext index

Fulltext indexes build an inverted index over a text column and allow:

Search behavior (what counts as a term, case/word-form handling, wildcard support) is configured at index creation time via tokenizers and filters (for example, lowercase, Snowball stemming, n-grams). For details, see the index creation syntax Fulltext index.

Learn more: