CoreSeek 全文检索centos 安装

下载文件  CoreSeek
文件下载地址:
http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.14.tar.gz

将下载的文件上传至服务器的目录中


安装步骤大致和官网类似
安装的机器为centos 6.4

一、
给用户提取权限
$ sudo root bash
二、中文测试环境检查:
$  locale
##以下为核心项,locale为zh_CN.UTF-8,就可以正常显示和输入中文;locale设置功能由操作系统自身支持,BSD/Linux均可开启;该功能,不是coreseek提供的!!!
##如果不能正常显示中文,则后面的中文测试部分无法正常进行,但不会影响coreseek的实际功能;
    LANG=zh_CN.UTF-8
   LC_ALL="zh_CN.UTF-8"

测试命令
$ cat testpack/var/test/test.xml
三、安装中文分词
$ cd mmseg-3.2.14

$ ./bootstrap $ ./configure --prefix=/usr/local/mmseg3 $ make && make install
如果执行./bootstrap 提示没有权限 可以先将文件提权
$ chmod 0700 bootstrap
安装完成后测试数据
$  /usr/local/mmseg3/bin/mmseg -d /usr/local/mmseg3/etc src/t1.txt
中文/x 分/x 词/x 测试/x 
    中国人/x 上海市/x 

Word Splite took: 1 ms.

说明安装分词技术成功

四、安装coreseek
$ cd csft-3.2.14
$ sh buildconf.sh
$ ./configure --prefix=/usr/local/coreseek --without-python --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg3/lib/ --without-mysql
$ make && make install
如果./configure 提示没有权限 先执行 chmod 0700 configure 

如果出现编译失败的话 提示
make[2]: *** [indexer] 错误 1 
make[2]: Leaving directory `/setup/coreseek-3.2.14/csft-3.2.14/src' 
make[1]: *** [all] 错误 2 
make[1]: Leaving directory `/setup/coreseek-3.2.14/csft-3.2.14/src' 

make: *** [all-recursive] 错误 1

这种错误
解决办法:
定位到csft-3.2.14目录
修改src/Makefile,
搜索LIBS找到这行:
LIBS = -lm -lz -lexpat  -L/usr/local/lib -lrt  -lpthread
修改为:
LIBS = -lm -lz -lexpat -liconv -L/usr/local/lib -lrt  -lpthread
先配置./configure
然后再修改
修改后再编译make && make install
终于通过了


第一次编译失败 查看官网问题出在这里按照步骤来 执行成功
## 如果出现undefined reference to `libiconv'的类似错误,可以按照如下方法处理:
##方法一:(Linux使用)
## 直接执行:export LIBS="-liconv"
##然后make clean,再次configure后,进行编译安装make && make install
## 方法二:
## 首先configure,然后vim src/makefile
## 在其中搜索lexpat,在其后加上 -liconv
## 修改后该行应该为:-lexpat -liconv -L/usr/local/lib
## 然后再次make && make install
## 方法三:
## 首先configure,然后vim config/config.h
## 在其中搜索USE_LIBICONV,将其后的1修改为0
## 然后再次make && make install

$ /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx-min.conf.dist


至此 coreseek安装完成 下面就是mysql了

五、测试运行
我用开源 lnmp 搭建的环境 则mysql就不需要安装, 只需要配置下既可使用了
将安装包是放在/usr/local 文件夹中
先将目录定位到文件夹中

$ cd /usr/local/coreseek-3.2.14
$ cd testpack
$  /usr/local/coreseek/bin/indexer -c etc/csft.conf
##以下为正常情况下的提示信息:
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file 'etc/csft.conf'...
    total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
    total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
##
##csft-4.0版显示:ERROR: nothing to do.
##
$  /usr/local/coreseek/bin/indexer -c etc/csft.conf --all
##以下为正常索引全部数据时的提示信息:(csft-4.0版类似)
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file 'etc/csft.conf'...
    indexing index 'xml'...
    collected 3 docs, 0.0 MB
    sorted 0.0 Mhits, 100.0% done
    total 3 docs, 7585 bytes
    total 0.075 sec, 101043 bytes/sec, 39.96 docs/sec
    total 2 reads, 0.000 sec, 5.6 kb/call avg, 0.0 msec/call avg
    total 7 writes, 0.000 sec, 3.9 kb/call avg, 0.0 msec/call avg

$  /usr/local/coreseek/bin/indexer -c etc/csft.conf xml
##以下为正常索引指定数据时的提示信息:(csft-4.0版类似)
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file 'etc/csft.conf'...
    indexing index 'xml'...
    collected 3 docs, 0.0 MB
    sorted 0.0 Mhits, 100.0% done
    total 3 docs, 7585 bytes
    total 0.069 sec, 109614 bytes/sec, 43.35 docs/sec
    total 2 reads, 0.000 sec, 5.6 kb/call avg, 0.0 msec/call avg
    total 7 writes, 0.000 sec, 3.9 kb/call avg, 0.0 msec/call avg

$  /usr/local/coreseek/bin/search -c etc/csft.conf
##以下为正常测试搜索时的提示信息:(csft-4.0版类似)
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file 'etc/csft.conf'...
    index 'xml': query '': returned 3 matches of 3 total in 0.093 sec

    displaying matches:
    1. document=1, weight=1, published=Thu Apr  1 22:20:07 2010, author_id=1
    2. document=2, weight=1, published=Thu Apr  1 23:25:48 2010, author_id=1
    3. document=3, weight=1, published=Thu Apr  1 12:01:00 2010, author_id=2

    words:


$  /usr/local/coreseek/bin/search -c etc/csft.conf -a Twittter和Opera都提供了搜索服务
##以下为正常测试搜索关键词时的提示信息:(csft-4.0版类似)
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

     using config file 'etc/csft.conf'...
    index 'xml': query 'Twittter和Opera都提供了搜索服务 ': returned 3 matches of 3 total in 0.038 sec

    displaying matches:
    1. document=3, weight=24, published=Thu Apr  1 12:01:00 2010, author_id=2
    2. document=1, weight=4, published=Thu Apr  1 22:20:07 2010, author_id=1
    3. document=2, weight=3, published=Thu Apr  1 23:25:48 2010, author_id=1

    words:
    1. 'twittter': 1 documents, 3 hits
    2. '和': 3 documents, 15 hits
    3. 'opera': 1 documents, 25 hits
    4. '都': 2 documents, 4 hits
    5. '提供': 0 documents, 0 hits
    6. '了': 3 documents, 18 hits
    7. '搜索': 2 documents, 5 hits
    8. '服务': 1 documents, 1 hits

$  /usr/local/coreseek/bin/searchd -c etc/csft.conf
##以下为正常开启搜索服务时的提示信息:(csft-4.0版类似)
    Coreseek Fulltext 3.2 [ Sphinx 0.9.9-release (r2117)]
    Copyright (c) 2007-2010,
    Beijing Choice Software Technologies Inc (http://www.coreseek.com)

    using config file 'etc/csft.conf'...
    listening on all interfaces, port=9312
##如要停止搜索服务,请使用/usr/local/coreseek/bin/searchd -c etc/csft.conf --stop
##如要已启动服务,要更新索引,请使用/usr/local/coreseek/bin/indexer -c etc/csft.conf --all --rotate



posted @ 2014-12-12 18:23  assassin0905  阅读(199)  评论(0)    收藏  举报