跳转到主要内容

textsearch_intl

结合 ICU 分词、规范化与 n-gram 匹配的多语言全文检索

概览

扩展包名版本分类许可证语言
textsearch_intl1.0FTSPostgreSQLC
ID扩展名BinLibLoadCreateTrustReloc模式
2290textsearch_intl否是否是否是-
相关扩展unaccent

Renamed from icu_parser; PGXN distribution 1.0.1 retains SQL/control 1.0. No direct upgrade from the old name. PostgreSQL 14-18, UTF8 and unaccent required; rebuild affected indexes after an ICU major-version change. Pigsty RPM and DEB packages are 1.0.1.

版本

类型仓库版本PG 大版本包名依赖
EXTPIGSTY1.01817161514textsearch_intlunaccent
RPMPIGSTY1.0.11817161514textsearch_intl_$v-
DEBPIGSTY1.0.11817161514postgresql-$v-textsearch-intl-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
el8.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
el9.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
el9.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
el10.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
el10.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
d12.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
d12.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
d13.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
d13.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
u22.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
u22.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
u24.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
u24.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
u26.x86_64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
u26.aarch64
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1
PIGSTY 1.0.1

构建

您可以使用 pig build 命令构建 textsearch_intl 扩展的 RPM / DEB 包:

pig build pkg textsearch_intl         # 构建 RPM / DEB 包

安装

您可以直接安装 textsearch_intl 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:

pig repo add pgsql -u          # 添加仓库并更新缓存

使用 pig 或者是 apt/yum/dnf 安装扩展:

安装
pig install textsearch_intl;          # 当前活跃 PG 版本安装
pig
pig ext install -y textsearch_intl -v 18  # PG 18
pig ext install -y textsearch_intl -v 17  # PG 17
pig ext install -y textsearch_intl -v 16  # PG 16
pig ext install -y textsearch_intl -v 15  # PG 15
pig ext install -y textsearch_intl -v 14  # PG 14
dnf
dnf install -y textsearch_intl_18       # PG 18
dnf install -y textsearch_intl_17       # PG 17
dnf install -y textsearch_intl_16       # PG 16
dnf install -y textsearch_intl_15       # PG 15
dnf install -y textsearch_intl_14       # PG 14
apt
apt install -y postgresql-18-textsearch-intl   # PG 18
apt install -y postgresql-17-textsearch-intl   # PG 17
apt install -y postgresql-16-textsearch-intl   # PG 16
apt install -y postgresql-15-textsearch-intl   # PG 15
apt install -y postgresql-14-textsearch-intl   # PG 14

创建扩展:

CREATE EXTENSION textsearch_intl CASCADE;  -- 依赖: unaccent

用法

来源:

textsearch_intl 将 ICU 分词、规范化和 n-gram 匹配组合为多语言全文检索功能。它要求 PostgreSQL 14 或更新版本、UTF8 数据库、ICU 和 unaccent;上游 CI 覆盖 PostgreSQL 14–18。

名称与版本

项目于 2026-10-09 从 icu_parser 改名为 textsearch_intl 并重新编号。2026-10-22 已正式发布新的 PGXN 分发 1.0.1;SQL/control 版本仍为 1.0,不能把分发版本误作 SQL 升级目标。旧名称没有直接的 SQL 升级脚本,迁移前需检查依赖对象并制定重建步骤。

核心用法

CREATE EXTENSION textsearch_intl CASCADE;
SELECT alias, token FROM ts_debug('intl_simple', '東京駅前ラーメン店 ร้านกาแฟ Café');
SELECT to_tsvector('intl_search', 'Café') @@ phraseto_tsquery('intl_search', 'cafe');
SELECT to_tsvector('intl_search_ngram', '행복한편의점')
       @@ phraseto_tsquery('intl_search_ngram', '편의점');
SELECT intl_icu_version();

检索配置

  • intl_simple 使用 intl 解析器,保留重音和字符宽度。
  • intl_search 组合 intl_normalize、unaccent 与 intl_join,进行规范化的整词检索。词语拼接默认关闭。
  • intl_search_ngram 使用 intl_runs 与 intl_ngram,匹配韩文、中日文词元内部,以及不带空格的泰文、老挝文、高棉文和缅甸文片段。N-gram 可能增加误匹配和索引体积。

运行边界

使用超级用户安装;扩展可迁移,未标记为可信,也不需要预加载。词序重要时优先使用 phraseto_tsquery()。intl_icu_version() 返回已加载的 ICU 版本;ICU 主版本改变后应重建相关索引。ICU 分词不是日文形态分析,部分 CJK 词前缀查询仍不可靠。

这个页面对您有帮助吗?