Ubuntu12.04 安装 Sphinx-for-chinese 全文检索引擎

1、下载Sphinx-for-chinese。

进入Sphinx-for-chinese官网,选择最新版下载。目前最新版是sphinx-for-chinese-2.2.1-dev-r4311.tar.gz。

解压下载的安装包:

$ tar xzvf sphinx-for-chinese-2.2.1-dev-r4311.tar.gz

2、安装依赖包,如果不安装依赖包,无法安装成功。

$ sudo apt-get install make gcc g++ automake libtool mysql-client libmysqlclient15-dev libxml2-dev libexpat1-dev

3、安装sphinx-for-chinese。

进入sphinx-for-chinese-2.2.1-dev-r4311目录

$ cd Downloads/sphinx-for-chinese-2.2.1-dev-r4311

编译(推荐安装到/usr/local/sphinx-for-chinese目录,下文同)

$ ./configure --prefix=/usr/local/sphinx-for-chinese

make

$ make & make install

4、配置中文支持。

下载xdict_1.1.tar.gz.
解压xdcit_1.1.tar.gz

$ tar xzvf xdict_1.1.tar.gz

从xdict_1.1.txt生成xdict文件,xdict_1.1.txt文件可以根据需要进行修改

$ /usr/local/sphinx-for-chinese/bin/mkdict xdict_1.1.txt xdict

将字典 xdict 拷贝到 /usr/local/sphinx-for-chinese/etc目录下

 
$ cp xdict /usr/local/sphinx-for-chinese/etc/

5、修改sphinx.conf索引配置文件。

进入sphinx-forchinese安装目录下etc目录

$ cd /usr/local/sphinx-for-chinese/etc

指定sphinx配置文件

$ sudo cp sphinx.conf.dist sphinx.conf

修改配置

$ sudo vim sphinx.conf

找到 ‘charset_type = sbcs’ 字样,将其改为

charset_type    = utf-8
chinese_dictionary = /usr/local/sphinx-for-chinese/etc/xdict

至此,中文配置完成。

广告


JackSun

JackSun

I'm a coder.

You may also like...

Leave a Reply

Your email address will not be published.