首页 » SEO优化 » coreseekphp扩大技巧_sphinxcoreseek安装

coreseekphp扩大技巧_sphinxcoreseek安装

访客 2024-11-07 0

扫一扫用手机浏览

文章目录 [+]

wget http://sphinxsearch.com/files/sphinx-2.0.3-release.tar.gz tar zxvf sphinx-2.0.3-release.tar.gz ./configure --prefix=/usr/local/sphinx --with-mysql make && make install cd /usr/local/sphinx cp etc/sphinx-min.conf.dist etc/sphinx.conf 测试数据库,新建test数据库,导入etc/example.sql做测试 #修正mysql帐户密码 vim etc/sphinx.conf #建立索引 bin/indexer -c etc/sphinx.conf test1 #查询 bin/search -c etc/sphinx.conf test #开启守护进程 bin/searchd -c etc/sphinx.conf

但是官方不支持中文分词,硬伤……

支持中文方案:

coreseekphp扩大技巧_sphinxcoreseek安装

安装 Sphinx-For-Chinese

coreseekphp扩大技巧_sphinxcoreseek安装
(图片来自网络侵删)

wget http://sphinx-for-chinese.googlecode.com/files/sphinx-for-chinese-2.1.0-dev-r3361.tar.bz2 tar -xvf sphinx-for-chinese-2.0.2-dev-r2894.tar.gz $ cd sphinx-for-chinese-2.0.2-dev-r2894 $ ./configure --prefix=/usr/local/sphinx-for-chinese --prefix 指定安装路径 --with-mysql 编译mysql支持 --with-pgsql 编译pgsql支持 $ make $ make install

配置中文支持

wget http://sphinx-for-chinese.googlecode.com/files/xdict_1.1.tar.gz $ tar -xvf xdict_1.1.tar.gz $ /usr/local/sphinx-for-chinese/bin/mkdict xdict\_1.1.txt xdict #从xdict\_1.1.txt天生xdict文件,xdict_1.1.txt文件可以根据须要进行修正 $ cp xdict /usr/local/sphinx-for-chinese/etc/

修正sphinx.conf索引配置文件,在索引配置项中添加以下两项

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

$ wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz$ tar xzvf coreseek-4.1-beta.tar.gz$ cd coreseek-4.1-beta/mmseg-3.2.14/$ ./bootstrap #输出的warning信息可以忽略,如果涌现error则须要办理$ ./configure --prefix=/usr/local/mmseg3$ make && make install$ cd ..

安装coreseek

$ cd csft-3.2.14 或者 cd csft-4.0.1 或者 cd csft-4.1$ sh buildconf.sh #输出的warning信息可以忽略,如果涌现error则须要办理$ ./configure --prefix=/usr/local/coreseek --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --with-mysql ##如果提示mysql问题,可以查看MySQL数据源安装解释$ make && make install$ cd ..

PHP安装sphinx扩展

# 先安装sphinxclient cd sphinx-2.0.3-release/api/libsphinxclient vim sphinxclient.c #找到 void sock_close ( int sock ); 改为 static void sock_close ( int sock ); ./configure --prefix=/usr/local/sphinxclient make && make installwget http://pecl.php.net/get/sphinx-1.3.0.tgz tar zxvf sphinx-1.3.0.tgz cd sphinx-1.3.0 /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config --with-sphinx=/usr/local/sphinxclient make && make install

php.ini加入sphinx.so

这里末了选择Coreseek 更新索引,可以放在Crontab中实行,每天自动更新

/usr/local/coreseek/bin/indexer --rotate -c /usr/local/coreseek/etc/sphinx.conf --all

标签:

相关文章

我国土地利用分类代码的构建与应用

土地利用分类代码是我国土地管理的重要组成部分,是土地资源调查、规划、利用和保护的依据。土地利用分类代码的构建与应用显得尤为重要。本...

SEO优化 2025-02-18 阅读1 评论0

微信跳转微信支付便捷支付体验的秘密武器

移动支付已成为人们日常生活中不可或缺的一部分。作为我国领先的社交平台,微信支付凭借其便捷、安全的支付方式,深受广大用户的喜爱。而微...

SEO优化 2025-02-18 阅读0 评论0

探寻会计科目代码背后的奥秘分类与

会计科目代码是会计信息系统中不可或缺的组成部分,它将企业的经济活动进行分类和归纳,为会计核算、财务分析和决策提供重要依据。本文将从...

SEO优化 2025-02-18 阅读1 评论0