选择 打开 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

文档 / 函数百科 / 文本搜索函数和操作符

FUNCTION文本搜索函数和操作符

ts_parse

使用命名的解析器从document中提取标记。

Extracts tokens from the document using the named parser.

文本搜索函数和操作符 引入 9.0(基线) 现存至 20 devel 2 条签名 0 次签名变更

签名数
2 条
引入版本
9.0(基线)
状态
现存
签名变更
未变过
本版来源
本站译文

PostgreSQL 18 手册 · 9.13 文本搜索函数和操作符 官方文档

版本轨迹

相对 PostgreSQL 17 无变化。

签名

PostgreSQL 18 里 ts_parse 的 2 条签名,按上游手册顺序排列。参数名用斜体,类型用弱化色, 之后是返回类型。说明取自本站手册译文:标「沿用」的借用了另一版的译文,标「EN」的本站暂无译文、按英文原文显示。

  1. ts_parse ( parser_name text, document text ) → setof record ( tokid integer, token text )

    使用命名的解析器从document中提取标记。详情参见Section 12.8.2
    • ts_parse('default', 'foo - bar')(1,foo) ...
  2. ts_parse ( parser_oid oid, document text ) → setof record ( tokid integer, token text )

    使用 OID 指定的解析器从document中提取标记。 详情参见 Section 12.8.2
    • ts_parse(3722, 'foo - bar')(1,foo) ...

演化历史

相邻两个大版本之间的差异,新的在前。版本号链到该版的签名。

  1. PostgreSQL 13 ← 12 手册重排

    这一跳手册重排了函数表的写法,签名文本整体改写,只记函数的增删,不逐条比较签名。

签名矩阵

每条签名在给出了签名的 18 个版本里的存在情况;方格指向该版的签名。只在正文里提到此函数、没有给出签名的版本不列进来,上面的版本轨迹里仍然有它们。签名文本在 PostgreSQL 13 前后写法不同,跨越那一跳的同一条签名会显示成两行。

存在 不存在

签名 9.09.19.29.39.49.59.61011121314151617181920
ts_parse ( parser_name text, document text, OUT tokid integer, OUT token text ) → setof record 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在
ts_parse ( parser_oid oid, document text, OUT tokid integer, OUT token text ) → setof record 存在 存在 存在 存在 存在 存在 存在 存在 存在 存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在
ts_parse ( parser_name text, document text ) → setof record ( tokid integer, token text ) 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在
ts_parse ( parser_oid oid, document text ) → setof record ( tokid integer, token text ) 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 不存在 存在 存在 存在 存在 存在 存在 存在 存在

同组函数

函数 签名 主签名 版本变动 最近变更
TEXT SEARCH FUNCTIONS AND OPERATORS 文本搜索函数和操作符 27 个
array_to_tsvector 1 array_to_tsvector ( text[] ) → tsvector
将文本字符串数组转换为tsvector。 现存
get_current_ts_config基线 1 get_current_ts_config ( ) → regconfig
返回当前默认文本搜索配置的OID(由 default_text_search_config 所设定的). 现存
json_to_tsvector 1 json_to_tsvector ( [ config regconfig, ] document json, filter jsonb ) → tsvector
选择filter请求的JSON文档中的每个项,并将每个项转换为tsvector,根据指定的或默认配置对单词进行标准化。 现存
jsonb_to_tsvector 1 jsonb_to_tsvector ( [ config regconfig, ] document jsonb, filter jsonb ) → tsvector
选择filter请求的JSON文档中的每个项,并将每个项转换为tsvector,根据指定的或默认配置对单词进行标准化。 现存
numnode基线 1 numnode ( tsquery ) → integer
返回tsquery中词位和操作符的数目。 现存
phraseto_tsquery 1 phraseto_tsquery ( [ config regconfig, ] query text ) → tsquery
将文本转换为tsquery,根据指定的或默认配置对单词进行标准化。 现存
plainto_tsquery基线 1 plainto_tsquery ( [ config regconfig, ] query text ) → tsquery
将文本转换为tsquery,根据指定的或默认配置对单词进行标准化。 现存
querytree基线 1 querytree ( tsquery ) → text
生成tsquery中可索引部分的表示。 现存
setweight基线 2 setweight ( vector tsvector, weight "char" ) → tsvector 9.61 次
将指定的weight赋给vector的每个元素。 现存
strip基线 1 strip ( tsvector ) → tsvector
从tsvector中移除位置和权重。 现存
to_tsquery基线 1 to_tsquery ( [ config regconfig, ] query text ) → tsquery
将文本转换为tsquery,根据指定的或默认配置对单词进行标准化。 现存
to_tsvector基线 3 to_tsvector ( [ config regconfig, ] document text ) → tsvector 101 次
将文本转换为tsvector,根据指定的或默认配置对单词进行标准化。 现存
ts_debug基线 1 ts_debug ( [ config regconfig, ] document text ) → setof record ( alias text, description text, token text, dictionaries regdictionary[], dictionary regdictionary, lexemes text[] )
根据指定的或默认的文本搜索配置从document中提取和标准化标记,并返回关于每个标记是如何处理的信息。 现存
ts_delete 2 ts_delete ( vector tsvector, lexeme text ) → tsvector
从vector中删除给定的lexeme的任何出现。 现存
ts_filter 1 ts_filter ( vector tsvector, weights "char"[] ) → tsvector
只从vector中选择具有给定weights的元素。 现存
ts_headline基线 3 ts_headline ( [ config regconfig, ] document text, query tsquery [, options text ] ) → text 101 次
以缩写形式显示document中query的匹配项,该匹配项必须是原始文本,而不是tsvector。 现存
ts_lexize基线 1 ts_lexize ( dict regdictionary, token text ) → text[]
如果字典知道输入标记,则返回替换词位数组;如果字典知道标记,但它是停止词,则返回空数组;如果它不是已知词,则返回NULL。 现存
ts_parse基线 2 ts_parse ( parser_name text, document text ) → setof record ( tokid integer, token text )
使用命名的解析器从document中提取标记。 现存
ts_rank基线 1 ts_rank ( [ weights real[], ] vector tsvector, query tsquery [, normalization integer ] ) → real
计算一个分数,显示vector与query的匹配程度。 现存
ts_rank_cd基线 1 ts_rank_cd ( [ weights real[], ] vector tsvector, query tsquery [, normalization integer ] ) → real
使用覆盖密度算法计算一个分数,显示vector与query的匹配程度。 现存
ts_rewrite基线 2 ts_rewrite ( query tsquery, target tsquery, substitute tsquery ) → tsquery
在query中使用 substitute替换出现的target。 现存
ts_stat基线 1 ts_stat ( sqlquery text [, weights text ] ) → setof record ( word text, ndoc integer, nentry integer )
执行sqlquery,该查询必须返回单个tsvector列,并返回数据中每个不同词元的统计信息。 现存
ts_token_type基线 2 ts_token_type ( parser_name text ) → setof record ( tokid integer, alias text, description text )
返回一个表,该表描述命名解析器可以识别的每种类型的标记。 现存
tsquery_phrase 2 tsquery_phrase ( query1 tsquery, query2 tsquery ) → tsquery
构造一个短语查询,在连续的词位上搜索query1和query2的匹配项(与<->操作符相同)。 现存
tsvector_to_array 1 tsvector_to_array ( tsvector ) → text[]
将tsvector转换为词位的数组。 现存
unnest基线 4 unnest ( tsvector ) → setof record ( lexeme text, positions smallint[], weights text ) 143 次
将tsvector展开为一组行,每个行对应一个词位。 现存
websearch_to_tsquery 1 websearch_to_tsquery ( [ config regconfig, ] query text ) → tsquery
将文本转换为tsquery,根据指定的或默认配置对单词进行标准化。 现存