coreseek安裝和使用(一)

  • 什么是sphinx,sphinx和coreseek有什么區(qū)別和作用。
  • coreseek的安裝和配置。
  • coreseek的使用方式。

sphinx和coreseek

  • ** sphinx: **
    Sphinx是開源的搜索引擎,它支持英文的全文檢索。
  • ** coreseek: **
    單獨(dú)搭建Sphinx,已經(jīng)可以使用全文索引了。但是往往我們要求的是中文索引,coreseek就是國人提供了一個(gè)可供企業(yè)使用的,基于Sphinx的中文全文檢索引擎。也就是說Coreseek實(shí)際上的內(nèi)核還是Sphinx。

coreseek安裝流程和遇到問題的解決方法

  1. 第一步下載coreseek安裝包,點(diǎn)擊下載coreseek的3.2.14.tar.gz版本
  2. 下載完成后解壓進(jìn)入coreseek目錄,會發(fā)現(xiàn)有兩個(gè)目錄csft-3.2.14和mmseg-3.2.14,這里簡單說明下:Csft-3.2.14就相當(dāng)玩sphinx安裝目錄,mmseg-3.2.14即為中文分詞安裝包,先安裝中文分詞庫,請看代碼:
    Cd coreseek-3.2.14/ mmseg-3.2.14
    ./configure --prefix=/usr/local/mmseg/
    

./configure出現(xiàn)錯(cuò)誤:config.status: error: cannot find input file: src/Makefile.in
要先安裝automake,再重新執(zhí)行configure

yum -y install autoconf automake
aclocal
yum -y install libtool
aclocal
libtoolize –force
automake --add-missing
make
make install
  1. 安裝中文分詞mmseg完畢,安裝coreseek。
cd ../ csft-3.2.14
./configure --prefix=/usr/local/coreseek --with-mysql=/usr/local/mysql --with-mmseg-includes=/usr/local/mmseg/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg/lib/
make
make install
        ```
但我的環(huán)境是使用yum直接安裝的lnmp,不知道m(xù)ysql的地址。需要先安裝mysql-devel ,再安裝csft的時(shí)候直接用-with-mysql 會自動(dòng)搜索安裝的mysql的文件。重新執(zhí)行上面的代碼,--with--mysql不用帶參數(shù),自動(dòng)搜索。

4. 安裝好coreseek和mmesg我們要給php加上sphinx模塊,這樣php就可以用到sphinx軟件的功能,先下載php的sphinx模塊包,代碼如下

wget http://pecl.php.net/get/sphinx-1.1.0.tgz
tar zxvf sphinx-1.1.0.tgz
cd sphinx-1.1.0
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

安裝擴(kuò)張有可能遇到的錯(cuò)誤:
一、configure: error: Cannot find libsphinxclient headers
解決方法:進(jìn)入下載包的ctsf文件夾的api文件夾找到libsphinxclient文件夾,進(jìn)入文件夾編譯安裝configure make && make isntall
二、/root/sphinx-1.1.0/sphinx.c:1888:43: warning: assignment from incompatible pointer type [enabled by default]
這是因?yàn)閿U(kuò)張的版本和以安裝的php的版本之間代碼的嚴(yán)格行造成的。
修改sphinx.c文件105行,添加默認(rèn)值null
retval = std_hnd->read_property(object, member, type TSRMLS_CC, NULL);
配置擴(kuò)展:在php.ini的下面加上:extension=”sphinx.so”
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容