select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / TEXT SEARCH FUNCTIONS AND OPERATORS

Assigns the specified weight to each element of the vector.

Signatures & examples

setweight ( vector tsvector, weight "char" ) → tsvector
Assigns the specified weight to each element of the vector.
setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A') → 'cat':3A 'fat':2A,4A 'rat':5A
setweight ( vector tsvector, weight "char", lexemes text[] ) → tsvector
Assigns the specified weight to elements of the vector that are listed in lexemes. The strings in lexemes are taken as lexemes as-is, without further processing. Strings that do not match any lexeme in vector are ignored.
setweight('fat:2,4 cat:3 rat:5,6B'::tsvector, 'A', '{cat,rat}') → 'cat':3A 'fat':2,4 'rat':5A,6A
Version history 2
  1. PG 12 → 13changed
  2. PG 9.5 → 9.6changed

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source