[root@prod /opt/nlpbamboo-1.1.2/build]# echo "/usr/lib" >>/etc/ld.so.conf
[root@prod /opt/nlpbamboo-1.1.2/build]# echo "/usr/local/lib" >>/etc/ld.so.conf
[root@prod /opt/nlpbamboo-1.1.2/build]# ldconfig -f /etc/ld.so.conf
测试是否正常:
[root@prod /opt/nlpbamboo-1.1.2/build]# ldconfig -p|grep bambo
libbamboo.so.2 (libc6,x86-64) => /usr/lib/libbamboo.so.2
libbamboo.so (libc6,x86-64) => /usr/lib/libbamboo.so
[root@prod /opt/nlpbamboo-1.1.2/build]# ldconfig -p|grep crf
libcrfpp.so.0 (libc6,x86-64) => /usr/local/lib/libcrfpp.so.0
libcrfpp.so (libc6,x86-64) => /usr/local/lib/libcrfpp.so
6.加入索引:[root@prod /opt/bamboo/exts/postgres/chinese_parser]# touch $PGHOME/share/tsearch_data/chinese_utf8.stop
[root@prod /opt/bamboo/exts/postgres/chinese_parser]# cd /opt/bamboo/exts/postgres/pg_tokenize
[root@prod /opt/bamboo/exts/postgres/chinese_parser]# make[root@prod /opt/bamboo/exts/postgres/chinese_parser]# su postgres
[postgres@prod /opt/bamboo/exts/postgres/chinese_parser]$ cd /opt/pgsql/share/contrib/
[postgres@prod /opt/pgsql/share/contrib]$ psql -h 127.0.0.1 postgres postgres -f chinese_parser.sql
[postgres@prod /opt/pgsql/share/contrib]$ psql -h 127.0.0.1 postgres postgres -f pg_tokenize.sqlpostgres=# select * from tokenize('你好我是中国人');
ERROR: invalid byte sequence for encoding "UTF8": 0xc4 0xe3
ERROR: invalid byte sequence for encoding "UTF8": 0xc4 0xe3
原因是没有正确设置客户端字符集。postgres=# select * from tpg_ts_config;
cfgname | cfgnamespace | cfgowner | cfgparser
------------+--------------+----------+-----------
simple | 11 | 10 | 3722
danish | 11 | 10 | 3722
dutch | 11 | 10 | 3722
english | 11 | 10 | 3722
finnish | 11 | 10 | 3722
french | 11 | 10 | 3722
german | 11 | 10 | 3722
hungarian | 11 | 10 | 3722
italian | 11 | 10 | 3722
norwegian | 11 | 10 | 3722
portuguese | 11 | 10 | 3722
romanian | 11 | 10 | 3722
russian | 11 | 10 | 3722
spanish | 11 | 10 | 3722
swedish | 11 | 10 | 3722
turkish | 11 | 10 | 3722
chinesecfg | 11 | 10 | 16453
(17 rows)
测试:来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25954236/viewspace-1809299/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25954236/viewspace-1809299/