array_to_tsvector()

A function for converting an array to a tsvector

array_to_tsvector() is a system function  for converting an array of lexemes to a tsvector.

array_to_tsvector() was added in PostgreSQL 9.6.

Usage

array_to_tsvector ( text[] ) → tsvector

The provided strings are not processed before conversion.

Change history

Examples

Basic usage example for array_to_tsvector():

postgres=# SELECT array_to_tsvector(ARRAY['foo','bar','baz']);
 array_to_tsvector 
-------------------
 'bar' 'baz' 'foo'
(1 row)

Duplicate values will be consolidated:

postgres=# SELECT array_to_tsvector('{foo,bar,bar}'::text[]);
 array_to_tsvector 
-------------------
 'bar' 'foo'
(1 row)

Categories

Arrays, Full Text Search, System function

See also

tsvector_to_array()