Search Postgresql Archives

Finding intercept of two documents (two tsvector fields)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux