下载MediaWiki的Sphinx插件:mediawiki-extensions-SphinxSearch-master.tar.gz
在Debian上安装Sphinx,先安装依赖,再从sphinx官网下载deb的安装包,注意即便是postgres也需要依赖mysql-client
解压Sphinx的wiki插件,修改其中的sphinx.conf,修改内容如附件所示,主要针对postgres数据库进行更改
测试sphinx的indexer功能,使用命令
/path/to/sphinx/installation/bin/indexer --config /path/to/sphinx.conf --all
- 开启sphinx的后台守护进程
/path/to/sphinx/installation/bin/searchd --config /path/to/sphinx.conf
- 设置增量更新
crontab -e
0 3 * * * /path/to/sphinx/installation/indexer --quiet --config /path/to/sphinx.conf wiki_main --rotate >/dev/null 2>&1; /path/to/sphinx/installation/indexer --quiet --config /path/to/sphinx.conf wiki_incremental --rotate >/dev/null 2>&1
- 设置LocalSetting.php
$wgSearchType = 'SphinxMWSearch';require_once "$IP/extensions/SphinxSearch/SphinxSearch.php";
- 遇到
DEPRECATED: Do not call this method or, even better, use SphinxQL instead of an API in /var/www/wiki/extensions/SphinxSearch/sphinxapi.php on line 763, referer: XXX
只需要把
function SetMatchMode ( $mode )
{
trigger_error ( 'DEPRECATED: Do not call this method or, even better, use SphinxQL instead of an API', E_USER_DEPRECATED );
assert ( $mode==SPH_MATCH_ALL
|| $mode==SPH_MATCH_ANY
|| $mode==SPH_MATCH_PHRASE
|| $mode==SPH_MATCH_BOOLEAN
|| $mode==SPH_MATCH_EXTENDED
|| $mode==SPH_MATCH_FULLSCAN
|| $mode==SPH_MATCH_EXTENDED2 );
$this->_mode = $mode;
}
里面的trigger_error注释掉就行了
Get the latest posts delivered right to your inbox.