Why is PostgreSQL stripping HTML objects in ts_headline ()?

I am writing a prototype full-text search that will return the found documents "headers" in the search results. Here's a slightly modified example from Postgres Docs :

SELECT ts_headline('english',
  'The most common type of search is to find all documents containing given query terms <b>and</b> return them in <order> of their similarity to the query.',
  to_tsquery('query & similarity'),
  'StartSel = XXX, StopSel = YYY');

What I expect will be something like

"documents containing given XXXqueryYYY terms <b>and</b> return them in <order> of their XXXsimilarityYYY to the XXXqueryYYY."

Instead i get

"documents containing given XXXqueryYYY terms  and  return them in   of their XXXsimilarityYYY to the XXXqueryYYY."

It looks like everything that looked remotely like an HTML tag is torn and replaced with a single space (note the double spaces around and).

, , Postgres , HTML, , . Api StartSel StopSel <b> </b>, , .

- , ?

+4

Source: https://habr.com/ru/post/1658941/


All Articles