Linux下搭建coreseek(sphinx+mmseg3)全文檢索

測試平臺:Center OSjavascript

一、設置環境,升級/安裝系統基礎依賴包:m四、autoconf、automake、libtoolphp

    #設置路徑和中文環境:
    $ export PATH=/usr/local/bin:$PATH
    $ export LC_ALL=zh_CN.UTF-8
    $ export LANG=zh_CN.UTF-8
   #下載安裝基礎依賴包
    $ curl -O -L http://mirrors.kernel.org/gnu/m4/m4-1.4.13.tar.gz
    $ tar -xzvf m4-1.4.13.tar.gz
    $ cd m4-1.4.13
    $ ./configure --prefix=/usr/local
    $ make && make install
    $ cd ..

    $ curl -O -L http://mirrors.kernel.org/gnu/autoconf/autoconf-2.65.tar.gz
    $ tar -xzvf autoconf-2.65.tar.gz
    $ cd autoconf-2.65
    $ ./configure --prefix=/usr/local
    $ make && make install
    $ cd ..

    $ curl -O -L http://mirrors.kernel.org/gnu/automake/automake-1.11.tar.gz
    $ tar xzvf automake-1.11.tar.gz
    $ cd automake-1.11
    $ ./configure --prefix=/usr/local
    $ make && make install
    $ cd ..

    $ curl -O -L http://mirrors.kernel.org/gnu/libtool/libtool-2.2.6b.tar.gz
    $ tar xzvf libtool-2.2.6b.tar.gz
    $ cd libtool-2.2.6b
    $ ./configure --prefix=/usr/local
    $ make && make install
    $ cd ..

二、下載安裝coreseekjava

   #下載coreseek:
        $ curl -O -L http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz
        $ tar xzvf coreseek-3.2.14.tar.gz
        $ cd coreseek-3.2.14

    #安裝mmseg
        $ cd mmseg-3.2.14
        $ ./bootstrap
        $ ./configure --prefix=/usr/local/mmseg3
        $ make && make install
        $ cd ..
    遇到的問題:
      error: cannot find input file: src/Makefile.in
      或者遇到其餘相似error錯誤時...
    解決方案:
      依次執行下面的命令,我運行'aclocal'時又出現了錯誤,解決方案請看下文描述
      yum -y install libtool
      aclocal
      libtoolize --force
      automake --add-missing
      autoconf
      autoheader
      make clean
     
      #安裝coreseek
      $ cd csft-3.2.14
      $ 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數據源安裝說明   http://www.coreseek.cn/product_install/install_on_bsd_linux/#mysql
      $ make && make install
        若是編譯出錯:
            一、‘
this->ExprEval’ instead.....
             編輯sphinxexpr.cpp
            將全部的:T val = ExprEval ( this->m_pArg, tMatch );
             替換爲:T val = this->ExprEval ( this->m_pArg, tMatch );
             保存並從新編譯
      $ cd ..
      ##命令行測試mmseg分詞,coreseek搜索(須要預先設置好字符集爲zh_CN.UTF-8,確保正確顯示中文)
      $ cd testpack
      $ cat var/test/test.xml #此時應該正確顯示中文       $ /usr/local/mmseg3/bin/mmseg -d /usr/local/mmseg3/etc var/test/test.xml       $ /usr/local/coreseek/bin/indexer -c etc/csft.conf --all       $ /usr/local/coreseek/bin/search -c etc/csft.conf 網絡搜索
      遇到問題:
        出現這個 xmlpipe2 support NOT compiled in. To use xmlpipe2, install missing XML libra  錯誤。
      解決方案:
        
yum -y install expat expat-devel
     
      依次安裝後,重新編譯coreseek,而後再生成索引,就能夠經過了。
      結果以下:
        Coreseek Fulltext 4.1 [ Sphinx 2.0.2-dev (r2922)]
        Copyright (c) 2007-2011,
        Beijing Choice Software Technologies Inc (http://www.coreseek.com)
        using config file 'etc/csft.conf'...
        index 'xml': query '網絡搜索 ': returned 1 matches of 1 total in 0.000 sec
        displaying matches:
        1. document=1, weight=1590, published=Thu Apr 1 07:20:07 2010, author_id=1
        words:
          1. '網絡': 1 documents, 1 hits
          2. '搜索': 2 documents, 5 hits
相關文章
相關標籤/搜索