Displays, in an abbreviated form, the match(es) for the query in the document, which must be raw text not a tsvector.
Signatures & examples
ts_headline ( [ config regconfig, ] document text, query tsquery [, options text ] ) → text
Displays, in an abbreviated form, the match(es) for the query in the document, which must be raw text not a tsvector. Words in the document are normalized according to the specified or default configuration before matching to the query. Use of this function is discussed in Section 12.3.4, which also describes the available options.
ts_headline('The fat cat ate the rat.', 'cat') → The fat <b>cat</b> ate the rat
ts_headline ( [ config regconfig, ] document json, query tsquery [, options text ] ) → text
Displays, in an abbreviated form, match(es) for the query that occur in string values within the JSON document. See Section 12.3.4 for more details.
ts_headline('{"cat":"raining cats and dogs"}'::jsonb, 'cat') → {"cat": "raining <b>cats</b> and dogs"}
ts_headline ( [ config regconfig, ] document jsonb, query tsquery [, options text ] ) → text
Displays, in an abbreviated form, match(es) for the query that occur in string values within the JSON document. See Section 12.3.4 for more details.
ts_headline('{"cat":"raining cats and dogs"}'::jsonb, 'cat') → {"cat": "raining <b>cats</b> and dogs"}