Re: small bug in hlCover - Mailing list pgsql-hackers

From Sushant Sinha
Subject Re: small bug in hlCover
Date
Msg-id 1217790917.6025.0.camel@dragflick
Whole thread Raw
In response to small bug in hlCover  (Sushant Sinha <sushant354@gmail.com>)
Responses Re: small bug in hlCover
List pgsql-hackers
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.



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Mini improvement: statement_cost_limit
Next
From: "Hans-Jürgen Schönig"
Date:
Subject: Re: Mini improvement: statement_cost_limit