zoukankan      html  css  js  c++  java
  • Linux下搭建coreseek(sphinx+mmseg3)全文检索

    测试平台:Center OS

    1、设置环境,升级/安装系统基础依赖包:m4、autoconf、automake、libtool

        #设置路径和中文环境:
        $ 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 ..
    

    2、下载安装coreseek

       #下载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
            如果编译出错:
                1、‘
    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

      

  • 相关阅读:
    JVM常量池
    Java内存分配之堆、栈和常量池
    Visual studio code快捷键
    spring 注解方式配置Bean
    Spring注解@Qualifier
    编程问题总结
    七天学会ASP.NET MVC (五)——Layout页面使用和用户角色管理
    七天学会ASP.NET MVC (六)——线程问题、异常处理、自定义URL
    七天学会ASP.NET MVC (四)——用户授权认证问题
    七天学会ASP.NET MVC (三)——ASP.Net MVC 数据处理
  • 原文地址:https://www.cnblogs.com/ym1992it/p/5225877.html
Copyright © 2011-2022 走看看