Sphinx中文分词在discuz 中的应用
Sphinx中文分词在discuz 中的应用。
Sphinx-for-chinese是一款专注于中文搜索的全文检索软件,在sphinx的基础上添加了中文处理模块并优化了中文搜索效果。相比而言,以某某论坛几千万数据环境来看,比Coreseek封装的sphinx中文分词+mmseg3组合要好一点
1.准备环境
cd /var/tmp/ wget http://www.sphinx-search.com/downloads/sphinx-for-chinese-2.2.1-dev-r4311.tar.gz wget http://docs.zjyxh.com/discuzx/sphinx-for-chinese/xdict mkdir -p /data0/dzbbs/indexdata/ mkdir -p /data1/dzbbs/indexdata/
2.安装 sphinx for chinese
CXX=gcc CFLAGS=" -O3 -fomit-frame-pointer -pipe -march=nocona -mfpmath=sse -m128bit-long-double -mmmx -msse -msse2 -maccumulate-outgoing-args -m64 -ftree-loop-linear -fprefetch-l oop-arrays -freg-struct-return -fgcse-sm -fgcse-las -frename-registers -fforce-addr -fivopts -ftree-vectorize -ftracer -frename-registers -minline-all-stringops -fbranch-target- load-optimize2" CXXFLAGS="${CFLAGS}" export CXX CXXFLAGS CFLAGS tar zxf sphinx-for-chinese-2.2.1-dev-r4311.tar.gz cd sphinx-for-chinese-2.2.1-dev-r4311 ./configure --prefix=/usr/local/sfc22/ --with-mysql=/usr/local/mysql/ --enable-id64 make -j8 install
3.配置 sphinx for chinese
cd /usr/local/sfc22/etc/
mv xdict xdictbak
cp -a /var/tmp/xdict .
vim sphinx.conf
source pre_forum_thread
{
type = mysql
sql_host = localhost
sql_user = sphinx
sql_pass = sphinx2013
sql_db = discuzx
sql_port = 3306
sql_query_pre = SET NAMES UTF8
sql_query_pre = SET SESSION query_cache_type=OFF
sql_query_pre = REPLACE INTO pre_common_sphinxcounter SELECT 1, MAX(tid) FROM pre_forum_thread
sql_query = SELECT t.tid as id,t.tid,t.subject,t.digest,t.displayorder,t.authorid,t.lastpost,t.special \
FROM pre_forum_thread AS t \
WHERE t.tid>=$start AND t.tid<=$end
- 发表评论
-
- 最新评论 更多>>