Previous   Next 

Function to_tsvector

Converts text into a tsvector (text search vector) data type of lexemes or word stems that has been processed by dictionaries specified by a configuration.

to_tsvector([configuration OID | TEXT, ] txt TEXT) RETURNS TSVECTOR

  • If specified, 'configuration' is the oid or text name of a configuration listed in table pg_ts_cfg.
  • 'txt' is the text that is to be parsed and processed by dictionaries.
  • A tsvector is returned that contains the processed word stems.
SELECT to_tsvector('simple', 'vacuumdb is a utility for cleaning a PostgreSQL database.');
                                       
				       to_tsvector
------------------------------------------------------------------------------------------
 'a':3,7 'is':2 'for':5 'utility':4 'cleaning':6 'database':9 'vacuumdb':1 'postgresql':8
(1 row)

SELECT to_tsvector('default', 'vacuumdb is a utility for cleaning a PostgreSQL database.');
                        
			to_tsvector
------------------------------------------------------------
 'util':4 'clean':6 'databas':9 'vacuumdb':1 'postgresql':8
(1 row)

SELECT to_tsvector('default_english', 'vacuumdb is a utility for cleaning a PostgreSQL database.');
                          
			  to_tsvector
----------------------------------------------------------------
 'clean':6 'utility':4 'database':9 'vacuumdb':1 'postgresql':8
(1 row)