tsvector extraction patch

Lists: pgsql-hackers
From: Hans-Juergen Schoenig -- PostgreSQL <postgres(at)cybertec(dot)at>
To: pgsql-hackers(at)postgresql(dot)org, zb(at)cybertec(dot)at
Subject: tsvector extraction patch
Date: 2009-07-03 07:49:41
Message-ID: 4A4DB815.1000702@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

hello,

this patch has not made it through yesterday, so i am trying to send it
again.
i made a small patch which i found useful for my personal tasks.
it would be nice to see this in 8.5. if not core then maybe contrib.
it transforms a tsvector to table format which is really nice for text
processing and comparison.

test=# SELECT * FROM tsvcontent(to_tsvector('english', 'i am pretty sure
this is a good patch'));
lex | rank
--------+------
good | 8
patch | 9
pretti | 3
sure | 4
(4 rows)

many thanks,

hans

--
Cybertec Schoenig & Schoenig GmbH
Reyergasse 9 / 2
A-2700 Wiener Neustadt
Web: www.postgresql-support.de


From: Hans-Juergen Schoenig -- PostgreSQL <postgres(at)cybertec(dot)at>
To: pgsql-hackers(at)postgresql(dot)org, zb(at)cybertec(dot)at
Subject: Re: tsvector extraction patch
Date: 2009-07-03 08:01:08
Message-ID: 4A4DBAC4.4010003@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hans-Juergen Schoenig -- PostgreSQL wrote:
> hello,
>
> this patch has not made it through yesterday, so i am trying to send
> it again.
> i made a small patch which i found useful for my personal tasks.
> it would be nice to see this in 8.5. if not core then maybe contrib.
> it transforms a tsvector to table format which is really nice for text
> processing and comparison.
>
> test=# SELECT * FROM tsvcontent(to_tsvector('english', 'i am pretty
> sure this is a good patch'));
> lex | rank
> --------+------
> good | 8
> patch | 9
> pretti | 3
> sure | 4
> (4 rows)
>
> many thanks,
>
> hans
>

--
Cybertec Schoenig & Schoenig GmbH
Reyergasse 9 / 2
A-2700 Wiener Neustadt
Web: www.postgresql-support.de

Attachment Content-Type Size
tsvcontent-0.1-ctxdiff.diff text/x-patch 7.1 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Cc: "Hans-Juergen Schoenig -- PostgreSQL" <postgres(at)cybertec(dot)at>, zb(at)cybertec(dot)at
Subject: Re: tsvector extraction patch
Date: 2009-07-06 07:43:43
Message-ID: 200907061043.43684.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Friday 03 July 2009 10:49:41 Hans-Juergen Schoenig -- PostgreSQL wrote:
> hello,
>
> this patch has not made it through yesterday, so i am trying to send it
> again.
> i made a small patch which i found useful for my personal tasks.
> it would be nice to see this in 8.5. if not core then maybe contrib.
> it transforms a tsvector to table format which is really nice for text
> processing and comparison.
>
> test=# SELECT * FROM tsvcontent(to_tsvector('english', 'i am pretty sure
> this is a good patch'));
> lex | rank
> --------+------
> good | 8
> patch | 9
> pretti | 3
> sure | 4
> (4 rows)

Sounds useful. But in the interest of orthogonality (or whatever), how about
instead you write a cast from tsvector to text[], and then you can use
unnest() to convert that to a table, e.g.,

SELECT * FROM unnest(CAST(to_tsvector('...') AS text[]));


From: Mike Rylander <mrylander(at)gmail(dot)com>
To: Hans-Juergen Schoenig -- PostgreSQL <postgres(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org, zb(at)cybertec(dot)at
Subject: Re: tsvector extraction patch
Date: 2009-07-06 15:25:35
Message-ID: b918cf3d0907060825n6ad84148s4c8ee67e6716aca5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jul 3, 2009 at 3:49 AM, Hans-Juergen Schoenig --
PostgreSQL<postgres(at)cybertec(dot)at> wrote:
> hello,
>
> this patch has not made it through yesterday, so i am trying to send it
> again.
> i made a small patch which i found useful for my personal tasks.
> it would be nice to see this in 8.5. if not core then maybe contrib.
> it transforms a tsvector to table format which is really nice for text
> processing and comparison.
>
> test=# SELECT * FROM tsvcontent(to_tsvector('english', 'i am pretty sure
> this is a good patch'));
> lex   | rank
> --------+------
> good   |    8
> patch  |    9
> pretti |    3
> sure   |    4
> (4 rows)
>

This looks very useful! I wonder if providing a "weight" column would
be relatively simple? I think this would present problems with the
cast-to-text[] idea that Peter suggests, though.

--
Mike Rylander
| VP, Research and Design
| Equinox Software, Inc. / The Evergreen Experts
| phone: 1-877-OPEN-ILS (673-6457)
| email: miker(at)esilibrary(dot)com
| web: http://www.esilibrary.com


From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Mike Rylander <mrylander(at)gmail(dot)com>
Cc: Hans-Juergen Schoenig -- PostgreSQL <postgres(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org, zb(at)cybertec(dot)at
Subject: Re: tsvector extraction patch
Date: 2009-07-08 19:38:15
Message-ID: 20090708193815.GN5053@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Mike Rylander escribió:
> On Fri, Jul 3, 2009 at 3:49 AM, Hans-Juergen Schoenig --
> PostgreSQL<postgres(at)cybertec(dot)at> wrote:

> > test=# SELECT * FROM tsvcontent(to_tsvector('english', 'i am pretty sure
> > this is a good patch'));
> > lex   | rank
> > --------+------
> > good   |    8
> > patch  |    9
> > pretti |    3
> > sure   |    4
> > (4 rows)
> >
>
> This looks very useful! I wonder if providing a "weight" column would
> be relatively simple? I think this would present problems with the
> cast-to-text[] idea that Peter suggests, though.

Where would the weight come from?

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


From: Mike Rylander <mrylander(at)gmail(dot)com>
To: Hans-Juergen Schoenig -- PostgreSQL <postgres(at)cybertec(dot)at>, pgsql-hackers(at)postgresql(dot)org, zb(at)cybertec(dot)at
Subject: Fwd: tsvector extraction patch
Date: 2009-07-08 20:18:31
Message-ID: b918cf3d0907081318r1c9345ffr3e3d96912f1209d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Sorry, forgot to reply-all.

---------- Forwarded message ----------
From: Mike Rylander <mrylander(at)gmail(dot)com>
Date: Wed, Jul 8, 2009 at 4:17 PM
Subject: Re: [HACKERS] tsvector extraction patch
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>

On Wed, Jul 8, 2009 at 3:38 PM, Alvaro
Herrera<alvherre(at)commandprompt(dot)com> wrote:
> Mike Rylander escribió:
>> On Fri, Jul 3, 2009 at 3:49 AM, Hans-Juergen Schoenig --
>> PostgreSQL<postgres(at)cybertec(dot)at> wrote:
>
>> > test=# SELECT * FROM tsvcontent(to_tsvector('english', 'i am pretty sure
>> > this is a good patch'));
>> > lex   | rank
>> > --------+------
>> > good   |    8
>> > patch  |    9
>> > pretti |    3
>> > sure   |    4
>> > (4 rows)
>> >
>>
>> This looks very useful!  I wonder if providing a "weight" column would
>> be relatively simple?  I think this would present problems with the
>> cast-to-text[] idea that Peter suggests, though.
>
> Where would the weight come from?
>

From a tsvector column that has weights set via setweight().

--
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker(at)esilibrary(dot)com
 | web:  http://www.esilibrary.com

--
Mike Rylander
| VP, Research and Design
| Equinox Software, Inc. / The Evergreen Experts
| phone: 1-877-OPEN-ILS (673-6457)
| email: miker(at)esilibrary(dot)com
| web: http://www.esilibrary.com


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Hans-Juergen Schoenig -- PostgreSQL <postgres(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org, zb(at)cybertec(dot)at
Subject: Re: tsvector extraction patch
Date: 2010-01-07 18:26:08
Message-ID: 603c8f071001071026y548d1c63j591d85a00500bfad@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, Jul 3, 2009 at 3:01 AM, Hans-Juergen Schoenig -- PostgreSQL
<postgres(at)cybertec(dot)at> wrote:
> Hans-Juergen Schoenig -- PostgreSQL wrote:
>>
>> hello,
>>
>> this patch has not made it through yesterday, so i am trying to send it
>> again.
>> i made a small patch which i found useful for my personal tasks.
>> it would be nice to see this in 8.5. if not core then maybe contrib.
>> it transforms a tsvector to table format which is really nice for text
>> processing and comparison.
>>
>> test=# SELECT * FROM tsvcontent(to_tsvector('english', 'i am pretty sure
>> this is a good patch'));
>> lex   | rank
>> --------+------
>> good   |    8
>> patch  |    9
>> pretti |    3
>> sure   |    4
>> (4 rows)
>>
>>  many thanks,
>>
>>     hans

Hmm, looks like we never did anything about this. Hans-Juergen, you
should probably update this and add it to the open CommitFest if you
want it to be considered for 8.5.

https://commitfest.postgresql.org/action/commitfest_view/open

...Robert