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

From Richard Huxton
Subject Re: Identifying which column matches a full text search
Date
Msg-id 488F8BCE.5090701@archonet.com
Whole thread Raw
In response to Identifying which column matches a full text search  (Ryan Wallace <rywall@interchange.ubc.ca>)
Responses Re: Identifying which column matches a full text search  (Ryan Wallace <rywall@interchange.ubc.ca>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: "Igor Neyman"
Date:
Subject: Re: column names with - and (
Next
From: Emi Lu
Date:
Subject: Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date