array_to_tsvector(text[]) |
tsvector |
将词元数组转换为 tsvector |
array_to_tsvector('{fat,cat,rat}'::text[]) |
'cat' 'fat' 'rat' |
get_current_ts_config() |
regconfig |
获取默认的全文搜索配置 |
get_current_ts_config() |
english |
length(tsvector) |
integer |
tsvector 中的词元数 |
length('fat:2,4 cat:3 rat:5A'::tsvector) |
3 |
numnode(tsquery) |
integer |
tsquery 中的词元数与操作符数之和 |
numnode('(fat & rat) | cat'::tsquery) |
5 |
plainto_tsquery([ config regconfig , ] query text) |
tsquery |
生成 tsquery,忽略标点符号 |
plainto_tsquery('english', 'The Fat Rats') |
'fat' & 'rat' |
phraseto_tsquery([ config regconfig , ] query text) |
tsquery |
生成搜索短语的 tsquery,忽略标点符号 |
phraseto_tsquery('english', 'The Fat Rats') |
'fat' <-> 'rat' |
querytree(query tsquery) |
text |
获取 tsquery 中可索引的部分 |
querytree('foo & ! bar'::tsquery) |
'foo' |
setweight(vector tsvector, weight "char") |
tsvector |
为 vector 中的每个元素赋予 weight |
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 |
为 vector 中列在 lexemes 内的元素赋予 weight |
setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A', '{cat,rat}') |
'cat':3A 'fat':2,4 'rat':5A |
strip(tsvector) |
tsvector |
从 tsvector 中移除位置和权重 |
strip('fat:2,4 cat:3 rat:5A'::tsvector) |
'cat' 'fat' 'rat' |
to_tsquery([ config regconfig , ] query text) |
tsquery |
规范化单词并转换为 tsquery |
to_tsquery('english', 'The & Fat & Rats') |
'fat' & 'rat' |
to_tsvector([ config regconfig , ] document text) |
tsvector |
将文档文本转换为 tsvector |
to_tsvector('english', 'The Fat Rats') |
'fat':2 'rat':3 |
to_tsvector([ config regconfig , ] document json(b)) |
tsvector |
将文档中的每个字符串值转换为 tsvector,再按文档顺序串接,生成单个 tsvector |
to_tsvector('english', '{"a": "The Fat Rats"}'::json) |
'fat':2 'rat':3 |
ts_delete(vector tsvector, lexeme text) |
tsvector |
从 vector 中移除给定的 lexeme |
ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat') |
'cat':3 'rat':5A |
ts_delete(vector tsvector, lexemes text[]) |
tsvector |
从 vector 中移除 lexemes 所列词元的所有出现 |
ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat']) |
'cat':3 |
ts_filter(vector tsvector, weights "char"[]) |
tsvector |
仅从 vector 中选出具有给定 weights 的元素 |
ts_filter('fat:2,4 cat:3b rat:5A'::tsvector, '{a,b}') |
'cat':3B 'rat':5A |
ts_headline([ config regconfig, ] document text, query tsquery [, options text ]) |
text |
显示查询匹配内容 |
ts_headline('x y z', 'z'::tsquery) |
x y <b>z</b> |
ts_headline([ config regconfig, ] document json(b), query tsquery [, options text ]) |
text |
显示查询匹配内容 |
ts_headline('{"a":"x y z"}'::json, 'z'::tsquery) |
{"a":"x y <b>z</b>"} |
ts_rank([ weights float4[], ] vector tsvector, query tsquery [, normalization integer ]) |
float4 |
计算文档相对于查询的排名分值 |
ts_rank(textsearch, query) |
0.818 |
ts_rank_cd([ weights float4[], ] vector tsvector, query tsquery [, normalization integer ]) |
float4 |
使用覆盖密度计算文档相对于查询的排名分值 |
ts_rank_cd('{0.1, 0.2, 0.4, 1.0}', textsearch, query) |
2.01317 |
ts_rewrite(query tsquery, target tsquery, substitute tsquery) |
tsquery |
将查询中的 target 替换为 substitute |
ts_rewrite('a & b'::tsquery, 'a'::tsquery, 'foo|bar'::tsquery) |
'b' & ( 'foo' | 'bar' ) |
ts_rewrite(query tsquery, select text) |
tsquery |
使用 SELECT 命令提供的目标和替代内容进行替换 |
SELECT ts_rewrite('a & b'::tsquery, 'SELECT t,s FROM aliases') |
'b' & ( 'foo' | 'bar' ) |
tsquery_phrase(query1 tsquery, query2 tsquery) |
tsquery |
构造搜索 query1 后跟 query2 的查询(与 <-> 操作符相同) |
tsquery_phrase(to_tsquery('fat'), to_tsquery('cat')) |
'fat' <-> 'cat' |
tsquery_phrase(query1 tsquery, query2 tsquery, distance integer) |
tsquery |
构造搜索 query1 后跟 query2、间距为 distance 的查询 |
tsquery_phrase(to_tsquery('fat'), to_tsquery('cat'), 10) |
'fat' <10> 'cat' |
tsvector_to_array(tsvector) |
text[] |
将 tsvector 转换为词元数组 |
tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector) |
{cat,fat,rat} |
tsvector_update_trigger() |
trigger |
自动更新 tsvector 列的触发器函数 |
CREATE TRIGGER ... tsvector_update_trigger(tsvcol, 'pg_catalog.swedish', title, body) |
|
tsvector_update_trigger_column() |
trigger |
自动更新 tsvector 列的触发器函数 |
CREATE TRIGGER ... tsvector_update_trigger_column(tsvcol, configcol, title, body) |
|
unnest(tsvector, OUT lexeme text, OUT positions smallint[], OUT weights text) |
setof record |
将 tsvector 展开为一组行 |
unnest('fat:2,4 cat:3 rat:5A'::tsvector) |
(cat,{3},{D}) ... |