Re: Use of tsvector in array

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Use of tsvector in array
Date: 2014-07-11 01:28:33
Message-ID: 1405042113726-5811215.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Huang, Suya wrote
> Hi,
>
> We have the requirement of using the data type tsvector [], however, I
> didn't find out how to:
>
> * Use array operator together with tsquery operator
>
> o I have to unnest the array and then do query like "ts@@
> to_tsquery('ipod')"

You will have to create some kind of custom operator. The easiest would be
to effectively duplicate the @@ operator but reverse the order of the
operands. Then you could do:

to_tsquery('ipod') @@^ ANY(tsvector_array)

Unfortunately the ANY must be applied to the right-hand type.

> * Create GIN index on tsvector[]
>
> o ERROR: data type tsvector[] has no default operator class for access
> method "gin"
>
> Not sure if anyone ever has this experience could share?

No clue but at a high level ISTM that tsvector[] is in many ways
functionally similar to "tsvector || tsvector" ... even if only for indexing
purposes

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Use-of-tsvector-in-array-tp5811210p5811215.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2014-07-11 06:00:25 Re: Windows Installation User account - Correct database for us
Previous Message David G Johnston 2014-07-11 00:50:14 Re: Windows Installation User account - Correct database for us