能否给一个基于WDCP的安装Sphinx的教程?
官方能否发布一个安装Sphinx的教程?在DZ要用到全文搜索,需要安装Sphinx,在网上找的方法都用不了,希望官方能出一个在WDCP里面安装的教程。按照以下方法操作都不行 [i=s] 本帖最后由 longyushen 于 2015-1-18 01:36 编辑 [/i]
例如:
1. 安装软件
wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.13.tar.gz
tar zxvf coreseek-3.2.13.tar.gz
cd coreseek-3.2.13
cd mmseg-3.2.13
./bootstrap #这一步也许会出错,提示很多command not found , 解决办法: 安装 libtool centos 直接使用yum安装 : yum install -y libtool
./configure --prefix=/usr/local/mmseg
make && make install
cd csft-3.2.13
./configure --prefix=/usr/local/sphinx --with-mysql=/www/wdlinux/mysql-5.1.63 --with-mmseg=/usr/local/mmseg/ --with-mmseg-includes=/usr/local/mmseg/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg/lib/
make && make install 2. 配置sphinx
vim /usr/local/sphinx/etc/csft.cnf # 内容如下
[attach]4994[/attach]
3. 首次生成索引
/usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/csft.conf --all
4. 启动sphinx
/usr/local/sphinx/bin/searchd --config /usr/local/sphinx/etc/csft.conf
5. 指定计划任务
* 0-3 * * * root /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/csft.conf posts_minute --rotate
* 6-23 * * * root /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/csft.conf posts_minute --rotate
0 4 * * * root /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/csft.conf posts_merge --rotate && /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/csft.conf --merge posts posts_merge --rotate
* 0-3 * * * root /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/csft.conf threads_minute --rotate
* 6-23 * * * root /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/csft.conf threads_minute --rotate
0 4 * * * root /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/csft.conf threads_merge --rotate && /usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/csft.conf --merge threads threads_merge --rotate
复制代码
6. 设置discuz后台
使用创始人账号登陆discuz后台, 全局 -> 搜索设置 ->
开启sphinx
sphinx 主机名 localhost
端口: 3312
标题索引名: threads,threads_minute
全文索引名:posts,posts_minute
项目数:10000
模式:保持默认即可
7. 更改discuz代码
打开/source/module/search/forum.php
找到以下这行
if($srchtype == 'fulltext' && $_G['setting']['sphinxon']) {
改成
if($_G['setting']['sphinxon']) {
再找到下面几行(注意:仅在你discuz版本为gbk时才需要做 以下修改)
f($srchtype == "fulltext") {
$result = $s->query("'".$srchtxt."'", $_G['setting']['sphinxmsgindex']);
} else {
$result = $s->query($srchtxt, $_G['setting']['sphinxsubindex']);
}
改成
$_srchtxt = iconv('gbk','utf-8',$srchtxt); //将gbk转成 utf-8
if($srchtype == "fulltext") {
$result = $s->query("'".$_srchtxt."'", $_G['setting']['sphinxmsgindex']);
} else {
$result = $s->query($_srchtxt, $_G['setting']['sphinxsubindex']);
} 顶上去,怎么没有人处理的呢? ,......... :lol。。。。。。 。。。。。。。。。。。。。。。。。。。。。。。 asdfasdfasdfasdfasdfasdf 分词这块还是不错的
页:
[1]