ts_delete()

A function for removing lexeme(s) from a tsvector

ts_delete() is a system function for removing lexeme(s) in a full text search tsvector.

ts_delete() was added in PostgreSQL 9.6.

Usage

ts_delete ( vector tsvector, lexeme text ) → tsvector
ts_delete ( vector tsvector, lexemes text[] ) → tsvector

Change history

Examples

Using ts_delete() to remove a single lexeme:

postgres=# SELECT ts_delete(to_tsvector('foo bar baz'), 'bar');
    ts_delete    
-----------------
 'baz':3 'foo':1
(1 row)

Using ts_delete() to remove multipe lexemes:

postgres=# SELECT ts_delete(to_tsvector('foo bar baz boo'), ARRAY['bar','boo']);
    ts_delete    
-----------------
 'baz':3 'foo':1
(1 row)

Categories

Full Text Search, System function

See also

ts_filter(), ts_rewrite()