Skip to content

postgrelize / toTsQuery

Function: toTsQuery() ​

toTsQuery(query, config?): Fn

Defined in: src/expressions/search-helpers.ts:95

postgrelize extension

to_tsquery([config,] query): parses tsquery syntax (&, |, !, <->). PostgreSQL extension.

Parameters ​

query ​

unknown

Query text in tsquery syntax, bound as a parameter. Invalid syntax is a database error.

config? ​

string

Text search configuration; the server default when omitted.

Returns ​

Fn

Function call expression.

Throws ​

Error when config is not a plain or schema-qualified identifier.

Example ​

ts
await Post.findAll({ where: { search: { [Op.match]: toTsQuery('cat & !dog', 'english') } } });

Released under the MIT License.