↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

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

百科 / 数据类型 / 全文检索

tsvector

全文检索文档

当前查看 PostgreSQL 18。

中文定义与说明

全文检索文档

同版本中文手册节选

PostgreSQL 提供了两种专为支持全文检索而设计的数据类型。所谓全文检索,是指在一组自然语言文档中查找最匹配某个查询的文档。tsvector 类型以适合文本检索的优化形式表示文档,tsquery 类型则表示文本查询。关于这一功能的详细解释见第 12 章;相关函数和操作符的概览见第 9.13 节。

查看完整中文手册与上下文。

PG10–20 核心源码清单。类型转换与操作符类列出源码显式声明的关系;缺少记录不能排除通过其他机制进行转换或使用索引。

定义

全文检索文档

tsvector
目录名称
pg_catalog.tsvector
类型 OID
3614
类型种类
基础类型
声明长度
变长(varlena)
存储策略
扩展
输入函数
tsvectorin
输出函数
tsvectorout

系统目录属性

此构建的源码初始化值。字段含义参见 pg_type 。包含头文件默认值;依赖构建的常量保留符号形式,不作为服务器运行时实测。

oid
3614
descr
text representation for text search
typacl
_null_
typlen
-1
typelem
0
typname
tsvector
typsend
tsvectorsend
typtype
b
typalign
i
typarray
0
typbyval
f
typdelim
','
typinput
tsvectorin
typmodin
-
typndims
0
typowner
POSTGRES
typrelid
0
typmodout
-
typoutput
tsvectorout
typtypmod
-1
typanalyze
ts_typanalyze
typdefault
_null_
typnotnull
f
typreceive
tsvectorrecv
typstorage
x
typbasetype
0
typcategory
U
typcollation
0
typisdefined
t
typnamespace
pg_catalog
typsubscript
-
typdefaultbin
_null_
array_type_oid
3643
typispreferred
f
array_type_name
_tsvector

运算符重载 11

每种操作数签名均为独立重载。实现函数和返回类型来自同一源码构建。

运算符左操作数右操作数返回类型含义实现函数
<tsvectortsvectorbool小于。tsvector_lt
<=tsvectortsvectorbool小于或等于。tsvector_le
=tsvectortsvectorbool等于。tsvector_eq
<>tsvectortsvectorbool不等于。tsvector_ne
>=tsvectortsvectorbool大于或等于。tsvector_ge
>tsvectortsvectorbool大于。tsvector_gt
||tsvectortsvectortsvector连接。tsvector_concat
@@tsvectortsquerybool全文搜索匹配。ts_match_vq
@@tsquerytsvectorbool全文搜索匹配。ts_match_qv
@@@tsvectortsquerybool已弃用,请改用 @@。ts_match_vq
@@@tsquerytsvectorbool已弃用,请改用 @@。ts_match_qv

操作符类 3

声明输入类型与此类型相符的操作符类。多态操作符类、类型转换和表达式索引还可能提供其他索引路径;不能仅凭此表判断是否支持索引。

操作符类索引方法输入类型操作符族默认存储类型
tsvector_opsbtreetsvectorbtree/tsvector_ops是与输入类型相同
tsvector_opsgisttsvectorgist/tsvector_ops是gtsvector
tsvector_opsgintsvectorgin/tsvector_ops是text

版本比较

PostgreSQL 17 → 18。属性比较不包含构建标识和说明正文;原始目录字段与源描述保留原文。

这两个样本的系统目录和结构化属性没有变化。

文档与源码

构建
18.6 · https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
指纹
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

相关条目

全部数据类型 · 下载此版本 JSON · 最早收录的样本不代表该类型的实际引入版本。