Re: Identifying which column matches a full text search - Mailing list pgsql-sql

From Ryan Wallace
Subject Re: Identifying which column matches a full text search
Date
Msg-id 007701c8f26c$e4a1ae10$ade50a30$@ubc.ca
Whole thread Raw
In response to Re: Identifying which column matches a full text search  (Richard Huxton <dev@archonet.com>)
Responses Re: Identifying which column matches a full text search  (Richard Huxton <dev@archonet.com>)
List pgsql-sql
Richard Huxton wrote:
>
> Failing that, where I've had many (a dozen) different sources but want 
> to search them all I've built a textsearch_blocks table with columns to 
> identify the source and have triggers that keep it up to date.

Once you've built the text search blocks table, how do you search it? Do you
perform
twelve separate queries or can you just do one?

Ryan

Ryan Wallace wrote:
> 
> UPDATE pgweb SET textsearchable_index_col =
>      to_tsvector('english', coalesce(title,'') || coalesce(body,''));

> WHERE textsearchable_index_col @@ to_tsquery('create & table')

> Using this approach. Is there any way of retrieving which of the original
> two columns the match was found in?

Afraid not - you're not indexing two columns, you're indexing one: 
textsearchable_index_col.

You can add up to four weights to a tsvector though, typically for 
title/body matching. See chapter 12.3 for details.

Failing that, where I've had many (a dozen) different sources but want 
to search them all I've built a textsearch_blocks table with columns to 
identify the source and have triggers that keep it up to date.

--   Richard Huxton  Archonet Ltd
No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.5.6/1579 - Release Date: 7/29/2008
6:43 AM



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: order function in aggregate
Next
From: Richard Huxton
Date:
Subject: Re: Identifying which column matches a full text search