8.3 version of ts_headline

Поиск
Список
Период
Сортировка
Искать

8.3 version of ts_headline

От:
Andreas Joseph Krogh <andreak@officenet.no>
Дата:
Hi.
In 8.2 this produces an error:

SELECT headline('default', 'a b c', 'c'::tsquery,
'StartSel=, StopSel=');
ERROR:  syntax error
DETAIL:  Syntax error in position 15.

while this works:
SELECT headline('default', 'a b c', 'c'::tsquery,
'StartSel=, StopSel=');  headline
--------------a b c
(1 row)

In the modern age people use stylesheets and it seems awkward that it's not 
possible to highlight headlines using stylesheets in PG. Is this intentional, 
or a glitch? Is it possible to extend ts_headline to support more advanced 
markup in StartSel?

-- 
Andreas Joseph Krogh 
Senior Software Developer / Manager
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Karenslyst Allé 11      | know how to do a thing and to watch         |
PO. Box 529 Skøyen      | somebody else doing it wrong, without       |
0214 Oslo               | comment.                                    |
NORWAY                  |                                             |
Tlf:    +47 24 15 38 90 |                                             |
Fax:    +47 24 15 38 91 |                                             |
Mobile: +47 909  56 963 |                                             |
------------------------+---------------------------------------------+

Re: 8.3 version of ts_headline

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Andreas Joseph Krogh  writes:
> In 8.2 this produces an error:

> SELECT headline('default', 'a b c', 'c'::tsquery,
> 'StartSel=, StopSel=');
> ERROR:  syntax error
> DETAIL:  Syntax error in position 15.

Sure you don't just need to quote the values?

regression=# SELECT ts_headline('english', 'a b c', 'c'::tsquery,
$$StartSel='', StopSel=''$$);           ts_headline            
-----------------------------------a b c
(1 row)

		regards, tom lane

Re: 8.3 version of ts_headline

От:
Andreas Joseph Krogh <andreak@officenet.no>
Дата:
On Friday 14 September 2007 20:26:28 Tom Lane wrote:
> Andreas Joseph Krogh  writes:
> > In 8.2 this produces an error:
> >
> > SELECT headline('default', 'a b c', 'c'::tsquery,
> > 'StartSel=, StopSel=');
> > ERROR:  syntax error
> > DETAIL:  Syntax error in position 15.
>
> Sure you don't just need to quote the values?
>
> regression=# SELECT ts_headline('english', 'a b c', 'c'::tsquery,
> $$StartSel='', StopSel=''$$);
>             ts_headline
> -----------------------------------
>  a b c
> (1 row)
>
>
> 			regards, tom lane

Doesn't work in 8.2:

andreak=# SELECT headline('default', 'a b c', 'c'::tsquery,
$$StartSel='', StopSel=''$$);
ERROR:  syntax error
DETAIL:  Syntax error in position 16.
andreak=# select version();                                           version
------------------------------------------------------------------------------------------------PostgreSQL 8.2.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 
(Ubuntu 4.1.2-0ubuntu4)
(1 row)


-- 
Andreas Joseph Krogh 
Senior Software Developer / Manager
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Karenslyst Allé 11      | know how to do a thing and to watch         |
PO. Box 529 Skøyen      | somebody else doing it wrong, without       |
0214 Oslo               | comment.                                    |
NORWAY                  |                                             |
Tlf:    +47 24 15 38 90 |                                             |
Fax:    +47 24 15 38 91 |                                             |
Mobile: +47 909  56 963 |                                             |
------------------------+---------------------------------------------+

Re: 8.3 version of ts_headline

От:
Teodor Sigaev <teodor@sigaev.ru>
Дата:
in 8.2
SELECT headline('default', 'a b c', 'c'::tsquery,
E'StartSel="", StopSel=""');

>>> In 8.2 this produces an error:
>>>
>>> SELECT headline('default', 'a b c', 'c'::tsquery,
>>> 'StartSel=, StopSel=');
>>> ERROR:  syntax error

-- 
Teodor Sigaev                                   E-mail: teodor@sigaev.ru                                                   WWW: http://www.sigaev.ru/

Re: 8.3 version of ts_headline

От:
Andreas Joseph Krogh <andreak@officenet.no>
Дата:
On Tuesday 18 September 2007 17:15:43 Teodor Sigaev wrote:
> in 8.2
> SELECT headline('default', 'a b c', 'c'::tsquery,
> E'StartSel="", StopSel=""');
>
> >>> In 8.2 this produces an error:
> >>>
> >>> SELECT headline('default', 'a b c', 'c'::tsquery,
> >>> 'StartSel=, StopSel=');
> >>> ERROR:  syntax error

Aha, thanks!

-- 
Andreas Joseph Krogh 
Senior Software Developer / Manager
------------------------+---------------------------------------------+
OfficeNet AS            | The most difficult thing in the world is to |
Karenslyst Allé 11      | know how to do a thing and to watch         |
PO. Box 529 Skøyen      | somebody else doing it wrong, without       |
0214 Oslo               | comment.                                    |
NORWAY                  |                                             |
Tlf:    +47 24 15 38 90 |                                             |
Fax:    +47 24 15 38 91 |                                             |
Mobile: +47 909  56 963 |                                             |
------------------------+---------------------------------------------+

FAQ