Re: Term positions in GIN fulltext index

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-hackers(at)postgresql(dot)org>, "Yoann Moreau" <yoann(dot)moreau(at)univ-avignon(dot)fr>
Subject: Re: Term positions in GIN fulltext index
Date: 2011-11-03 17:29:38
Message-ID: 4EB289320200002500042992@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Yoann Moreau <yoann(dot)moreau(at)univ-avignon(dot)fr> wrote:

> I'd need a function like this :
> select term_positions(text, 'get') from docs;
> id_doc | positions
> --------+-----------
> 1 | {2,6}
> 2 | {3}
>
> I'd like to add this function in my database, for experimental
> purpose. I got a look at the source code but didn't find some code
> example using the GIN index ;
> I can not figure out where the GIN index is read as a tsvector
> or where the '@@' operator gets the matching tsvectors for the
> terms of the tsquery.
>
> Any help about where to start reading would be very welcome :)

I'm not really clear on what you want to read about. Do you need
help creating your own function on the fly, or with how to access
the information to write the function?

If the former, these links might help:

http://www.postgresql.org/docs/9.1/interactive/extend.html

http://www.postgresql.org/docs/9.1/interactive/sql-createfunction.html

If the latter, have you looked at this file?:

src/backend/utils/adt/tsrank.c

Or was it something else that I'm missing?

-Kevin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2011-11-03 17:48:08 Refactor xlog.c #2 - xlog functions
Previous Message Simon Riggs 2011-11-03 16:57:06 Re: heap vacuum & cleanup locks