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
| Name | Type | Required | Description |
|---|---|---|---|
column | String / Symbol | Required | Column or expression to search — typically a tsvector column, but a text column works too (PostgREST coerces). |
query | String | Required | Search expression. The shape depends on type: — see options.type below. |
options | Hash | Optional | Optional hash with type: and config: keys (see "options keys" below). |
options keys
| Name | Type | Required | Description |
|---|---|---|---|
type | String | Optional | "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). |
config | String | Optional | Postgres 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")
.executeExample — plain phrase (plfts)
supabase
.from("posts")
.select("id, title")
.text_search("body", "ruby on rails", type: "plain")
.executeExample — exact phrase (phfts)
supabase
.from("articles")
.select("*")
.text_search("title", "supabase ruby docs", type: "phrase")
.executeExample — Google-style query (wfts)
supabase
.from("articles")
.select("*")
.text_search("body", "supabase ruby -python", type: "web_search")
.executeExample — non-default config
supabase
.from("articles")
.select("*")
.text_search("body", "voyageurs", type: "phrase", config: "french")
.execute