Sphinx安装笔记

 

// 下载所需文件
wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8-rc2.tar.gz
wget http://www.coreseek.com/uploads/sources/sphinx-0.98rc2.zhcn-support.patch
wget http://www.coreseek.com/uploads/sources/fix-crash-in-excerpts.patch
#wget http://www.coreseek.com/uploads/sources/coreseek_fulltext_2.5.tar.gz
wget http://www.coreseek.com/uploads/sources/mmseg-0.7.3.tar.gz

// 安装mmseg
tar xzf mmseg-0.7.3.tar.gz
cd mmseg-0.7.3
./configure –prefix=/usr/local/mmseg
make && make install

// 给sphinx打补丁
patch -p1 < ../sphinx-0.98rc2.zhcn-support.patch
patch -p1 < ../fix-crash-in-excerpts.patch

// 安装
./configure –prefix=/usr/local/sphinx –with-mysql=/usr/local/mysql-5.0.50 –with-mysql-includes=/usr/local/mysql-5.0.50/include/mysql/ –with-mysql-libs=/usr/local/mysql-5.0.50/lib/mysql –with-mmseg-includes=/usr/local/mmseg/include/mmseg –with-mmseg-libs=/usr/local/mmseg/lib


make & make install

 

如果出现编译错误 

 


Leaving directory********

 

官网解决办法:

 

In the meantime I’ve change the configuration file and set

#define USE_LIBICONV 0 in line 8179.

修改 configure 文件把 #define USE_LIBICONV 0 最后的数值由1改为0

重新编译。

 

// 生成词典
进入到mmseg的源代码目录后
cd data 然后执行
mmseg -u unigram.txt

在data下边会产生一个文件unigram.txt.uni
这个就是生成的字典 然后把字典改名为uni.lib放在可以读取的目录中即可

cp unigram.txt.uni /usr/local/sphinx/uni.lib

修改 sphinx.conf(/usr/local/sphinx/etc/sphinx.conf)配置文件加入以下:
charset_type = zh_cn.utf-8
charset_dictpath = /usr/local/sphinx/

 

你可能感兴趣的:(Sphinx安装笔记)