Re: tsearch2 in PostgreSQL 8.3?

From: "Trevor Talbot" <quension(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: "Bruce Momjian" <bruce(at)momjian(dot)us>, "Mike Rylander" <mrylander(at)gmail(dot)com>, "tomas(at)tuxteam(dot)de" <tomas(at)tuxteam(dot)de>, "Josh Berkus" <josh(at)agliodbs(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Oleg Bartunov" <oleg(at)sai(dot)msu(dot)su>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Subject: Re: tsearch2 in PostgreSQL 8.3?
Date: 2007-08-18 18:41:44
Message-ID: 90bce5730708181141i3e6b1c75xfb8c3148c014bc29@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/18/07, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Trevor Talbot wrote:

> > Well, you could create a function that returns a tsvector, but how do
> > you get that to work with queries? I've been under the impression the
> > expressions need to match (in the normal case, be the same function
> > with the same arguments) in order to use the index.
>
> Yes, so you create a function called complex_ts and create the index:
>
> CREATE INDEX ii on x USING GIT(complex_ts(col1, col2))
>
> and in your WHERE clause you do:
>
> WHERE 'a & b' @@ complex_ts(col1, col2)

Oh, duh, of course. I kept thinking of the index as something
abstract instead of reusing the expression, even when the examples
were right in front of me...

On 8/18/07, Joshua D. Drake <jd(at)commandprompt(dot)com> wrote:
> Bruce Momjian wrote:

> > CREATE INDEX ii on x USING GIT(complex_ts(col1, col2))
>
> GIN?

Freudian slip, that's what he thinks of me :D

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Trevor Talbot 2007-08-18 19:13:21 Re: text search vs schemas
Previous Message Joshua D. Drake 2007-08-18 17:52:45 Re: tsearch2 in PostgreSQL 8.3?