Re: [GENERAL] Fragments in tsearch2 headline

2008-05-23 Thread Teodor Sigaev
[moved to -hackers, because talk is about implementation details] I've ported the patch of Sushant Sinha for fragmented headlines to pg8.3.1 (http://archives.postgresql.org/pgsql-general/2007-11/msg00508.php) Thank you. 1 > diff -Nrub postgresql-8.3.1-orig/contrib/tsearch2/tsearch2.c now contr

Re: [GENERAL] Fragments in tsearch2 headline

2008-05-23 Thread Pierre-Yves Strub
On Fri, May 23, 2008 at 7:10 AM, Sushant Sinha <[EMAIL PROTECTED]> wrote: > Teodor did not want a separate function. He wanted it as an extension to > ts_headline. One way to do this will be to invoke it only when options > like MaxCoverSize is used. It will be slightly ugly though. What I underst

Re: [GENERAL] Fragments in tsearch2 headline

2008-05-22 Thread Sushant Sinha
Thanks Pierre for porting this! I just tested this for my application and it works. There was a small bug in that startHL has to be initialized to 0 for each chosen cover. I fixed that and attached the new patch. Teodor did not want a separate function. He wanted it as an extension to ts_headline.

Re: [GENERAL] Fragments in tsearch2 headline

2008-05-22 Thread Pierre-Yves Strub
Hi, I've ported the patch of Sushant Sinha for fragmented headlines to pg8.3.1 (http://archives.postgresql.org/pgsql-general/2007-11/msg00508.php) W.r.t, http://archives.postgresql.org/pgsql-general/2008-03/msg00806.php I can continue the work until this becomes an acceptable patch for pg. Pierr

Re: [GENERAL] Fragments in tsearch2 headline

2008-05-08 Thread Bruce Momjian
Where are we on this? --- Teodor Sigaev wrote: > > The patch takes into account the corner case of overlap. Here is the > > code for that > > // start check > > if (!startHL && *currentpos >= startpos) > >startHL = 1

Re: [GENERAL] Fragments in tsearch2 headline

2008-03-31 Thread Teodor Sigaev
The patch takes into account the corner case of overlap. Here is the code for that // start check if (!startHL && *currentpos >= startpos) startHL = 1; The headline generation will not start until currentpos has gone past startpos. Ok You can also check how this headline function is w

Re: [GENERAL] Fragments in tsearch2 headline

2008-03-28 Thread Sushant Sinha
Ah I missed this email. I agree with Teodor that this is not the best way to implement this functionality. At the time I was in a bit of hurry to have something better than the default one and just hacked this. And if we want to have this functionality across languages and parsers it will be better

Re: [GENERAL] Fragments in tsearch2 headline

2008-03-17 Thread Teodor Sigaev
Teodor, Oleg, do we want this? http://archives.postgresql.org/pgsql-general/2007-11/msg00508.php I suppose, we want it. But there are a questions/issues: - Is it needed to introduce new function? may be it will be better to add option to existing headline function. I'd like to keep cu

Re: [GENERAL] Fragments in tsearch2 headline

2008-03-17 Thread Bruce Momjian
Teodor, Oleg, do we want this? http://archives.postgresql.org/pgsql-general/2007-11/msg00508.php --- Sushant Sinha wrote: > I wrote a headline generation function for my app and I have attached > the patch (against

Re: [GENERAL] Fragments in tsearch2 headline

2007-11-21 Thread Bruce Momjian
This has been saved for the 8.4 release: http://momjian.postgresql.org/cgi-bin/pgpatches_hold --- Sushant Sinha wrote: > I wrote a headline generation function for my app and I have attached > the patch (against the

Re: [GENERAL] Fragments in tsearch2 headline

2007-11-11 Thread Sushant Sinha
I wrote a headline generation function for my app and I have attached the patch (against the cvs head). It generates multiple contexts in which the query appears. Essentially, it uses the cover function to generate all covers, chooses smallest covers and stretches each selected cover according to t

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-31 Thread Catalin Marinas
On 30/10/2007, Oleg Bartunov <[EMAIL PROTECTED]> wrote: > ok, then you have to formalize many things - how long should be excerpts, > how much excerpts to show, etc. In tsearch2 we have get_covers() function, > which produces all excerpts like: > > =# select get_covers(to_tsvector('1 2 3 4 5 3 4 ab

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-30 Thread Oleg Bartunov
On Tue, 30 Oct 2007, Tom Lane wrote: On 10/30/07, Oleg Bartunov <[EMAIL PROTECTED]> wrote: ... In tsearch2 we have get_covers() function, which produces all excerpts like: I had not realized till just now that the 8.3 core version of tsearch omitted any material feature of contrib/tsearch2.

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-30 Thread Tom Lane
> On 10/30/07, Oleg Bartunov <[EMAIL PROTECTED]> wrote: >> ... In tsearch2 we have get_covers() function, >> which produces all excerpts like: I had not realized till just now that the 8.3 core version of tsearch omitted any material feature of contrib/tsearch2. Why was get_covers() left out?

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-30 Thread Sushant Sinha
This is a nice idea and seems easy to implement. I will try to write it down and send a patch to the mailing list. I was also working to add support for phrase search. Currently to check for phrase you have to match the entire document. It will be better if a filter like are_words_consecutive(tsve

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-30 Thread Oleg Bartunov
On Tue, 30 Oct 2007, Catalin Marinas wrote: On 30/10/2007, Richard Huxton <[EMAIL PROTECTED]> wrote: Oleg Bartunov wrote: Catalin, what is your need ? What's wrong with this ? postgres=# select ts_headline('1 2 3 4 5 3 4 abc abc 2 3 xyz','2'::tsquery, 'StartSel=...,StopSel=...') ;

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-30 Thread Catalin Marinas
On 30/10/2007, Richard Huxton <[EMAIL PROTECTED]> wrote: > Oleg Bartunov wrote: > > Catalin, > > > > what is your need ? What's wrong with this ? > > > > postgres=# select ts_headline('1 2 3 4 5 3 4 abc abc 2 3 > > xyz','2'::tsquery, 'StartSel=...,StopSel=...') > > ; > > ts_headline

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-30 Thread Richard Huxton
Oleg Bartunov wrote: Catalin, what is your need ? What's wrong with this ? postgres=# select ts_headline('1 2 3 4 5 3 4 abc abc 2 3 xyz','2'::tsquery, 'StartSel=...,StopSel=...') ; ts_headline --- 1 ...2... 3 4 5 3 4 abc abc ...2... 3 x

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-30 Thread Oleg Bartunov
Catalin, what is your need ? What's wrong with this ? postgres=# select ts_headline('1 2 3 4 5 3 4 abc abc 2 3 xyz','2'::tsquery, 'StartSel=...,StopSel=...') ; ts_headline --- 1 ...2... 3 4 5 3 4 abc abc ...2... 3 xyz Oleg On Tue, 30 Oc

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-30 Thread Catalin Marinas
On 28/10/2007, Oleg Bartunov <[EMAIL PROTECTED]> wrote: > On Sat, 27 Oct 2007, Tom Lane wrote: > > > "Catalin Marinas" <[EMAIL PROTECTED]> writes: > >> Is there an easy way to generate a headline from separate fragments > >> containing the search words and maybe separated by "..."? > > > > Hmm, the

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-27 Thread Oleg Bartunov
On Sat, 27 Oct 2007, Tom Lane wrote: "Catalin Marinas" <[EMAIL PROTECTED]> 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: ts_headline

Re: [GENERAL] Fragments in tsearch2 headline

2007-10-27 Thread Tom Lane
"Catalin Marinas" <[EMAIL PROTECTED]> 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: ts_headline accepts a document along with a q

[GENERAL] Fragments in tsearch2 headline

2007-10-24 Thread Catalin Marinas
Hi, (I first posted it via google groups and realised that I have to be subscribed; now posting directly) I searched the list but couldn't find anyone raising the issue (or it might simply be my way of using the tool). I'd like to search through some text documents for words and generate headli