supabase-rb-rb
Database

Match by text search

High-level full-text search filter — picks the FTS variant and Postgres config.

Run a Postgres full-text search against a tsvector column. text_search is a convenience over the raw fts / plfts / phfts / wfts operators — pass type: to pick the variant and config: to pick a non-default text-search config (e.g. "english").

text_search lives on the select builder (SelectRequestBuilder), not on the universal FilterMixin. Call it after select, before .execute.

Signature

supabase.from(table).select(*columns).text_search(column, query, options = {})

Parameters

NameTypeRequiredDescription
columnString / SymbolRequiredColumn or expression to search — typically a tsvector column, but a text column works too (PostgREST coerces).
queryStringRequiredSearch expression. The shape depends on type: — see options.type below.
optionsHashOptionalOptional hash with type: and config: keys (see "options keys" below).

options keys

NameTypeRequiredDescription
typeStringOptional"plain" → plfts (treats the query as a plain phrase), "phrase" → phfts (matches the exact phrase), "web_search" → wfts (Google-style operators). Omit (or pass nil) for the default fts operator (tsquery syntax — & for AND, | for OR, ! for NOT).
configStringOptionalPostgres text-search config name (e.g. "english", "french"). Appears as fts(english) on the wire. Omit to use the default config.

Returns

Returns
Supabase::Postgrest::QueryRequestBuilder

A builder ready to .execute. Note: the return type is the base QueryRequestBuilder, not the filtered/modifier-mixed SelectRequestBuilder — chain text_search after you've added your other filters and modifiers, then .execute.

Example — default tsquery syntax

supabase
  .from("posts")
  .select("id, title")
  .text_search("body", "ruby & postgrest")
  .execute

Example — plain phrase (plfts)

supabase
  .from("posts")
  .select("id, title")
  .text_search("body", "ruby on rails", type: "plain")
  .execute

Example — exact phrase (phfts)

supabase
  .from("articles")
  .select("*")
  .text_search("title", "supabase ruby docs", type: "phrase")
  .execute

Example — Google-style query (wfts)

supabase
  .from("articles")
  .select("*")
  .text_search("body", "supabase ruby -python", type: "web_search")
  .execute

Example — non-default config

supabase
  .from("articles")
  .select("*")
  .text_search("body", "voyageurs", type: "phrase", config: "french")
  .execute

The lower-level fts, plfts, phfts, wfts filter mixins are also available on every verb builder if you want to call the raw operator directly.

On this page