small bug in hlCover

From: Sushant Sinha <sushant354(at)gmail(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: small bug in hlCover
Date: 2008-07-17 03:01:46
Message-ID: 1216263706.10473.10.camel@dragflick
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Attachment Content-Type Size
hlcover_bug.patch text/x-patch 921 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Abbas 2008-07-17 03:36:39 temp table problem
Previous Message daveg 2008-07-17 02:44:07 Re: pg_dump lock timeout