postgrelize / tsRank
Function: tsRank() ​
tsRank(
vector,query,options?):Fn
Defined in: src/expressions/search-helpers.ts:161
postgrelize extensionts_rank / ts_rank_cd: relevance of a tsvector for a tsquery, for attributes and order. PostgreSQL extension.
Parameters ​
vector ​
unknown
tsvector expression, e.g. col('search').
query ​
unknown
tsquery expression, e.g. websearchToTsQuery.
options? ​
TsRankOptions = {}
cd, weights and normalization.
Returns ​
Function call expression.
Throws ​
Error when weights is not four finite numbers or normalization is not an integer from 0 to 63.
Example ​
ts
const query = websearchToTsQuery('cat', 'english');
await Post.findAll({ where: { search: { [Op.match]: query } }, order: [[tsRank(col('search'), query, { normalization: 1 }), 'DESC']] });