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

From Ryan Wallace
Subject Identifying which column matches a full text search
Date
Msg-id 00c301c8f1a9$5e9b4420$1bd1cc60$@ubc.ca
Whole thread
Responses Re: Identifying which column matches a full text search
List pgsql-sql

Hi all,

 

The following example is given in the Postgres 8.3 manual regarding how to create a single ts_vector column for two existing columns:

 

ALTER TABLE pgweb ADD COLUMN textsearchable_index_col tsvector;

UPDATE pgweb SET textsearchable_index_col =

     to_tsvector('english', coalesce(title,'') || coalesce(body,''));

Then we create a GIN index to speed up the search:

CREATE INDEX textsearch_idx ON pgweb USING gin(textsearchable_index_col);

Now we are ready to perform a fast full text search:

SELECT title

FROM pgweb

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

ORDER BY last_mod_date DESC LIMIT 10;

 

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

 

Any help would be much appreciated,

Ryan

pgsql-sql by date:

Previous
From: "maria s"
Date:
Subject: Re: column names with - and (
Next
From: "Igor Neyman"
Date:
Subject: Re: column names with - and (