PostgreSQL 分词函数(不需要TSearch2支持)PostgreSQL分词函数需要安装好Bamboo的系统(不需要Bamboo源代码)。 如果您的系统中没有安装Bamboo,请参考: - 从源代码安装Bamboo:HowToBuild
- Bamboo 二进制包安装方法:BinaryInstall
编译和安装$ cd /opt/bamboo/exts/postgresql/tokenize
$ make
$ sudo make install 创建分词函数$ psql
postgres=# \i /usr/local/pgsql/share/contrib/pg_tokenize.sql 确保配置文件正确请确保/etc/bamboo.cfg或者/opt/etc/bamboo.cfg存在并正确配置。 测试postgres=# select tokenize('中文分词');
tokenize
------------
中文 分词
(1 row)Tsearch2 分词模块Tsearch2分词模块需要安装好Bamboo的系统以及Bamboo源代码。安装Bamboo请参考HowToBuild 编译和安装$ cd /opt/bamboo/exts/postgresql/chinese_parser
$ make
$ make install 创建分词模块$ psql
postgres=# \i /usr/local/pgsql/share/contrib/chinese_parser.sql 测试postgres=# SELECT to_tsvector('chinesecfg', '我爱北京天安门');
to_tsvector
-----------------------------------
'我':1 '爱':2 '北京':3 '天安门':4
(1 row)
|
$ psql postgres=# \i /usr/local/pgsql/share/contrib/chinese_parser.sql
来到这步的时候
psql:/usr/local/postgresql/share/contrib/chinese_parser.sql:39: ERROR: could not open stop-word file "/usr/local/postgresql/share/tsearch_data/chinese_utf8.stop": 没有那个文件或目录
我应该如何制作 chinese_utf8.stop ?谢谢
如果没有特殊需要,chinese_utf8.stop做一个空的就可以。
请问Tsearch2 分词模块适用于那个版本,pg8.3以前的可以吗
无法执行 $ cd /opt/bamboo/exts/postgresql/bamboo $ make $ sudo make install 需要帮助