From: | Sushant Sinha <sushant354(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | patch for space around the FragmentDelimiter |
Date: | 2009-03-01 22:21:26 |
Message-ID: | 1235946086.6678.17.camel@dragflick |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
FragmentDelimiter is an argument for ts_headline function to separates
different headline fragments. The default delimiter is " ... ".
Currently if someone specifies the delimiter as an option to the
function, no extra space is added around the delimiter. However, it does
not look good without space around the delimter.
Since the option parsing function removes any space around the given
value, it is not possible to add any desired space. The attached patch
adds space when a FragmentDelimiter is specified.
QUERY:
SELECT ts_headline('english', '
Day after day, day after day,
We stuck, nor breath nor motion,
As idle as a painted Ship
Upon a painted Ocean.
Water, water, every where
And all the boards did shrink;
Water, water, every where,
Nor any drop to drink.
S. T. Coleridge (1772-1834)
', to_tsquery('english', 'Coleridge & stuck'),
'MaxFragments=2,FragmentDelimiter=***');
OLD RESULT
ts_headline
--------------------------------------------
after day, day after day,
We <b>stuck</b>, nor breath nor motion,
As idle as a painted Ship
Upon a painted Ocean.
Water, water, every where
And all the boards did shrink;
Water, water, every where***drop to drink.
S. T. <b>Coleridge</b>
(1 row)
NEW RESULT after the patch
ts_headline
----------------------------------------------
after day, day after day,
We <b>stuck</b>, nor breath nor motion,
As idle as a painted Ship
Upon a painted Ocean.
Water, water, every where
And all the boards did shrink;
Water, water, every where *** drop to drink.
S. T. <b>Coleridge</b>
Attachment | Content-Type | Size |
---|---|---|
fragment_delimiter.patch | text/x-patch | 3.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Hannu Krosing | 2009-03-01 22:35:22 | Re: xpath processing brain dead |
Previous Message | Peter Eisentraut | 2009-03-01 21:50:02 | Re: cardinality() |