Re: Text search with multiple tables

From: "Mont Rothstein" <mont(dot)rothstein(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Text search with multiple tables
Date: 2008-05-01 16:51:13
Message-ID: 467a83630805010951i6807af9alc09dddbf38868287@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I found a way to do this but I don't know if there is a better way.
What I did was to create a separate index on each table and construct a
query like:

SELECT * FROM a WHERE (to_tsvector(...) @@ to_tsquery(...)) OR primaryKey IN
(SELECT distinct(foreign_key) FROM b WHERE to_tsvector(...) @@
to_tsquery(...))

Is there a better way to do this?

Thanks,
-Mont

On Thu, May 1, 2008 at 8:48 AM, Mont Rothstein <mont(dot)rothstein(at)gmail(dot)com>
wrote:

> Is it possible to perform a text search with tables A-->>B returning A for
> matches in B?
> What I want to do is to be able take columns from both A and B and perform
> a search based on the keywords entered by the user that matches A, B, or
> both but always returns A.
>
> Can this be done?
>
> Thanks,
> -Mont
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2008-05-01 17:03:21 Re: How to modify ENUM datatypes?
Previous Message Scott Marlowe 2008-05-01 16:44:02 Re: Deadlock situation?