中文全文检索pgroonga在HGDB-SEE V4.5.8版本编译

本文详细介绍了如何在PostgreSQL中安装和使用PGroonga扩展,包括依赖包安装、Git版本升级、Groonga编译安装、xxHash和vcpkg的使用,以及如何创建和使用全文搜索索引进行多语言查询和排序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

PGroonga 官网:https://pgroonga.github.io/

Description:PGroonga (píːzí:lúnɡά) is a PostgreSQL extension to use Groonga as the index.PostgreSQL supports full text search against languages that use only alphabet and digit. It means that PostgreSQL doesn’t support full text search against Japanese, Chinese and so on. You can use super fast full text search feature against all languages by installing PGroonga into your PostgreSQL!

一、安装相关依赖包
yum install wget curl tar gzip gcc gcc-c++ make zlib zlib-devel msgpack msgpack-devel mecab mecab-devel lz4 lz4-devel
二、下载安装 git

注意:编译要求Git版本为 V2.7.4及以上版本

wget https://www.kernel.org/pub/software/scm/git/git-2.7.4.tar.gz --no-check-certificate
tar -vzxf git-2.7.4.tar.gz 
cd git-2.7.4/
#Configure
./configure --with-openssl=/usr/local/openssl
#编译安装
make && make install
#打开操作系统环境变量配置文件,修改环境变量
vi /etc/profile
      #在底部加上git相关配置
      export PATH=$PATH:/usr/local/git-2.7.4
#:wq保存,source命令生效
source /etc/profile
#查看git版本
git --version
三、下载编译安装 groonga

Description:Groonga is an open-source fulltext search engine and column store. It lets you write high-performance applications that requires fulltext search.

官网:https://groonga.org/

编译安装:https://groonga.org/docs/install/centos.html#centos-7

PS:下载source进行源码编译,官网上的groonga-release-latest.noarch.rpm直接在本地安装会有问题(可能会存在文件缺失)。

wget https://packages.groonga.org/source/groonga/groonga-13.0.9.tar.gz --no-check-certificate
tar -xvzf groonga-13.0.9.tar.gz
cd groonga-13.0.9
#Configure
./configure
#编译Build
make -j$(grep '^processor' /proc/cpuinfo | wc -l)
#install
sudo make install
#install之后,执行如下命令查看当前系统安装了哪些库? 
pkg-config --list-all
#查看是否能查到groonga,若没有查到groonga头文件和库文件的位置,编译器无法使用,需要设置PKG_CONFIG_PATH环境变量
#查找groonga.pc的位置
find / -name groonga.pc
#设置PKG_CONFIG_PATH环境变量
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
#查看是否可输出groonga
pkg-config --list-all
#正常可输出groonga   Groonga - An Embeddable Fulltext Search Engine
四、下载安装 xxHash

Description:xxHash is an Extremely fast Hash algorithm, processing at RAM speed limits. Code is highly portable, and produces hashes identical across all platforms (little / big endian).

Vcpkg用于在Windows、Linux、Mac上管理C和C++库,极大简化了第三方库的安装,它由微软开源,源码地址:https://github.com/Microsoft/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值