Skip to content
masterclass Buddy

PostgreSQL · Function

rank

PostgreSQL ranking functions score full-text search matches. ts_rank uses match frequency, while ts_rank_cd also considers match proximity.

Last updated

Syntax

ts_rank([ weights float4[] , ] vector tsvector , query tsquery [ , normalization integer ]) returns float4
ts_rank_cd([ weights float4[] , ] vector tsvector , query tsquery [ , normalization integer ]) returns float4

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • ts_rank
  • ts_rank_cd
  • to_tsvector
  • to_tsquery
  • tsvector
  • tsquery

Source: PostgreSQL: Documentation: 18: 12.3. Controlling Text Search. Checked 2026-11-03.