Finding intercept of two documents (two tsvector fields) - Mailing list pgsql-general

From Allan Kamau
Subject Finding intercept of two documents (two tsvector fields)
Date
Msg-id AANLkTinNgadhJByS6ivOB-xmSaqWL=Mc846MRpMd9xMt@mail.gmail.com
Whole thread Raw
List pgsql-general
I am looking for a way to obtain the words that are common amongst two
tsvector records.

The long workaround I know is to:
1)convert the contents of the tsvector fields to text then find and
replace single quote followed by space then single quote with a comma
character then stripping away the first and last single quote
characters.
2)convert this CSV data into array using string to array.
3)Perform a join on these two arrays and unnest them and join on the
unnested values.
4)Perform array_agg on any one field (of unnested array values) of
these two tables with aid of a GROUP BY.
5)cast the array to string using a white space as the delimiter.
6)cast the string to tsvector.

Allan.

pgsql-general by date:

Previous
From: Henk van Lingen
Date:
Subject: Forcing the right queryplan
Next
From: "Joshua D. Drake"
Date:
Subject: Re: pg_dump --compress error