Re: tsearch2 in PostgreSQL 8.3?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Trevor Talbot <quension(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, 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>
Subject: Re: tsearch2 in PostgreSQL 8.3?
Date: 2007-08-18 16:28:10
Message-ID: 200708181628.l7IGSA718811@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Trevor Talbot wrote:
> Digging through the simple vs advanced user discussion, I don't think
> expression indexes are really the right idea. It seems a bit fragile,
> you need a certain amount of knowledge about the optimizer to figure
> out if your queries can even use the index, and it's just plain ugly.
> It also seems like the choice is between either simple one-column
> stuff, or triggers.
>
> There are already several CREATE FULLTEXT items, so what if you take
> it a bit farther:
>
> CREATE TABLE posts (title text, body text);
> CREATE FULLTEXT INDEX posts_fti ON posts (title WEIGHT A, body) CONFIG
> english USING GIN;
>
> ..with searches looking something like..
>
> ... WHERE plainto_tsquery('...') @@ posts_fti ...
>
> Okay, maybe that's not quite the right search abstraction (is it an
> index or a column?), but you get the idea.
>
> The point is that it would be fairly straightforward to do the common
> things, and it works for people whose needs can be met with a "full
> text index" rather than a "multidimensional search for lexemes" (or
> whatever tsvector + index really is). The configuration is clearly
> defined and stable, but queries can still use a GUC default.
> Meanwhile all the current functions, types and operators are there for
> use with triggers etc for advanced setups.
>
> There's obviously a lot of detail missing, but if something like this
> is the goal, then there doesn't need to be as much concern about
> simple interfaces for 8.3, as long as the framework is ok. In
> particular, expression indexes don't necessarily need special work
> now.

Remember an expression index can be a user-created function so you can
embed whatever you want in your function and just index it's output,
just like you would with a trigger creating a separate column.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-08-18 16:35:03 Re: "It'd be better if there were not an implicit cast from int8 to text..."
Previous Message Bruce Momjian 2007-08-18 16:24:53 Re: tsearch2 in PostgreSQL 8.3?f