Skip to content

postgrelize / tsHeadline

Function: tsHeadline() ​

tsHeadline(document, query, options?): Fn

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

postgrelize extension

ts_headline: a document excerpt with the query terms highlighted. PostgreSQL extension.

Parameters ​

document ​

unknown

Text expression or value, bound as a parameter.

query ​

unknown

tsquery expression.

options? ​

TsHeadlineOptions = {}

Configuration and ts_headline options string.

Returns ​

Fn

Function call expression.

Throws ​

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

Example ​

ts
await Post.findAll({ attributes: [[tsHeadline(col('body'), websearchToTsQuery('cat'), { options: 'StartSel=<b>, StopSel=</b>' }), 'excerpt']] });

Released under the MIT License.