Re: Fragments in tsearch2 headline - Mailing list pgsql-general

From Oleg Bartunov
Subject Re: Fragments in tsearch2 headline
Date
Msg-id Pine.LNX.4.64.0710280705320.14368@sn.sai.msu.ru
Whole thread Raw
In response to Re: Fragments in tsearch2 headline  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Fragments in tsearch2 headline  ("Catalin Marinas" <catalin.marinas@gmail.com>)
List pgsql-general
On Sat, 27 Oct 2007, Tom Lane wrote:

> "Catalin Marinas" <catalin.marinas@gmail.com> writes:
>> Is there an easy way to generate a headline from separate fragments
>> containing the search words and maybe separated by "..."?
>
> Hmm, the documentation for ts_headline claims it does this already:
>
>    <function>ts_headline</function> accepts a document along
>    with a query, and returns one or more ellipsis-separated excerpts from
>    the document in which terms from the query are highlighted.
>
> However, a quick look at the code suggests this is a lie --- I see no
> evidence whatever that there's any smarts for putting in ellipses.
>
> Oleg, Teodor, is there something I missed here?  Or do we need to change
> the documentation?

Probably documentation is not correct here. 'ellipsis-separated' should be
treated as a general wording. Default highlighting is <b>..</b> as it
stated below in docs.

postgres=# select ts_headline('this is a highlighted text','highlight'::tsquery, 'StartSel=...,StopSel=...')
postgres-# ;
            ts_headline
----------------------------------
  this is a ...highlighted... text


     Regards,
         Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Fragments in tsearch2 headline
Next
From: Wojtek Mach
Date:
Subject: Postgres+Apache+PHP (again, but in different setup)