ts_filter()
是一个系统函数,用于从 vector
中选择具有指定权重的元素。
ts_filter()
函数添加于 PostgreSQL 9.6。
变更历史
- PostgreSQL 9.6
- 已添加(提交 6943a946)
示例
ts_filter()
的基本用法示例
postgres=# WITH vec AS ( SELECT setweight(to_tsvector('A Fat Cat and a Rat'), 'A') || setweight(to_tsvector('the fat feline jumped over the sleeping rodent'), 'B') AS val ) SELECT ts_filter(val, '{b}') FROM vec; ts_filter --------------------------------------------------------- 'fat':8B 'felin':9B 'jump':10B 'rodent':14B 'sleep':13B (1 row)
参考资料
- PostgreSQL 文档: 文本搜索函数