BUG #16097: ts_headline fails on text with html style tag

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

BUG #16097: ts_headline fails on text with html style tag

PG Bug reporting form
The following bug has been logged on the website:

Bug reference:      16097
Logged by:          Stanislav B.
Email address:      [hidden email]
PostgreSQL version: 12.0
Operating system:   Linux. Ubuntu 18 and 16
Description:        

'ts_headline' function behaves really strang on text with '<style>' tags.

Scenario #1:
Set up: any text with <style> tag, containing any text under 2043 symbols;
Result: works as expected, no problems.

Scenario #2:
Set up: any text (use the sample code at the bottom of my message) with
<style> tag, containing any text (but more than 2043-2045 symbols);
Result: fails to process correctly, text with empty "<style><style>" tag
returned.

Scenario #3:
Set up: Take THE SAME setup from #2 scenario, but just rename "style" tag to
anything else, let's use "stylk". (You can take the sample code below and
change the tag);
Result: works as expected, no problems.

As you see, the problem occurs only if we use "style" tag here.

Here is the minimum sample code to reproduce the error:

>> CODE START
select ts_headline(
               '<h1>Ok</h1> <style type="text/css">.some-content {color:
grey} .some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} .some-content
{color: grey} .some-content {color: grey} .some-content {color: grey}
.some-content {color: grey} .some-content {color: grey} * {}</style> <p>Any
other content not affected</p>',
               'anything'::tsquery,
               'HighlightAll="1"'
           );
>>CODE END