Re: small bug in hlCover

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: sushant354(at)gmail(dot)com
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: small bug in hlCover
Date: 2008-10-17 17:44:25
Message-ID: 48F8CEF9.30507@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you, patch applied.

Sushant Sinha wrote:
> Has any one noticed this?
>
> -Sushant.
>
> On Wed, 2008-07-16 at 23:01 -0400, Sushant Sinha wrote:
>> I think there is a slight bug in hlCover function in wparser_def.c
>>
>> If there is only one query item and that is the first word in the text,
>> then hlCover does not returns any cover. This is evident in this example
>> when ts_headline only generates the min_words:
>>
>> testdb=# select ts_headline('1 2 3 4 5 6 7 8 9 10','1'::tsquery,
>> 'MinWords=5');
>> ts_headline
>> ------------------
>> <b>1</b> 2 3 4 5
>> (1 row)
>>
>> The problem is that *q is initialized to 0 which is a legitimate value
>> for a cover. So I have attached a patch that fixes it and after applying
>> the patch here is the result.
>>
>> testdb=# select ts_headline('1 2 3 4 5 6 7 8 9 10','1'::tsquery,
>> 'MinWords=5');
>> ts_headline
>> -----------------------------
>> <b>1</b> 2 3 4 5 6 7 8 9 10
>> (1 row)
>>
>> -Sushant.
>
>

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Teodor Sigaev 2008-10-17 18:33:20 Incorrect cursor behaviour with gist index
Previous Message Tom Lane 2008-10-17 17:34:43 Re: Improving planner variable handling