您的位置:首页 > 其它

coreseek 安装 配置 的及详细的使用方法

2017-05-16 15:22 567 查看
     

coreseek安装需要预装的软件:yum install make gcc g++ gcc-c++ libtool autoconf automake imake MySQL-devel libxml2-devel expat-devel

Ubuntu 安装扩展插件sudo apt-get install make gcc g++ automake libtool mysql-client libmysqlclient-dev libxml2-dev libexpat1-dev

cd /usr/local/src

wget 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

##ubuntu环境下,需要使用ACLOCAL_FLAGS="-I /usr/share/aclocal" ./bootstrap

./bootstrap #输出的warning信息可以忽略,如果出现error则需要解决

./configure --prefix=/usr/local/mmseg3

make && make install

cd ..

## 安装完成后,mmseg使用的词典和配置文件将自动安装到/usr/local/mmseg3/etc中

 

##安装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数据源安装说明

make && make install

 注:安装的过程中文件(sudo vi sphinxexpr.cpp)会报错 找到这个文件 修改 this->ExprEval

cd ..







 

 

4,测式coreseek

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

1,配置csft_mysql.conf文件

csft_mysql.conf位置(/usr/local/src/soreseek-3.2.14/testpack/etc/

Csft_mysql.conf) 

复制mysql配置文件到coreseek安装目录etc/下(比如/usr/local/coreseek/etc/)

cp /usr/local/src/coreseek-3.2.14/testpack/etc/csft_mysql.conf /usr/local/coreseek/etc/

cd /usr/local/coreseek/etc/

vi csft_mysql.conf

单表配置文件

source content

{

        type                     = mysql

        sql_host                 = localhost   

        sql_user                 = DB_USER

        sql_pass                 = DB_PASSWORD

        sql_db                   = DB_NAME

        sql_port                 = 3306  # optional, default is 3306

        sql_query_pre            = SET NAMES utf8

        sql_query                =  SELECT id, 1 AS group_id, title, pub_time, content FROM 表名   查询表 #sql_query第一列id需为整数

        sql_attr_uint                   = group_id  group_id 为表的标识 必须为整数

        #sql_attr_timestamp              = pub_time  #从SQL读取到的值必须为整数,作为时间属性 直接注释掉

        sql_query_info                  = SELECT * FROM contents WHERE id=$id  #命令行查询时,从数据库读取原始数据信息  可以注释 多表查询 sql_query_info                  = SELECT * WHERE ID=$id 

}

index content

{

        source                = content  #对应的source名称

        path          = /usr/local/coreseek/var/data/content  #必须为绝对路径

        docinfo               = extern

        charset_dictpath       = /usr/local/mmseg3/etc/

        charset_type           = zh_cn.utf-8

        ngram_len              = 0

enable_star = 0    min_infix_len = 1   #配置文件默认不支持模糊查询  添加这两个字段 支持模糊查询  

  infix_fields = OrgName,vcName  #设置要搜索的字段

}

indexer

{

        mem_limit               = 198M

}

searchd

{

        port                 = 9312

        log        = /usr/local/coreseek/var/log/searchd.log  #必须为绝对路径

        query_log      = /usr/local/coreseek/var/log/query.log #必须为绝对路径

        read_timeout         = 5

        max_children         = 30

        pid_file      = /usr/local/coreseek/var/log/searchd.pid #必须为绝对路径

 

        max_matches         = 1000

        seamless_rotate       = 1

        preopen_indexes      = 1

        unlink_old             = 1

}

//多表配置文件

  根据继承关系设置多表  

source table_1

{

        type                     = mysql

        sql_host                 = localhost   

        sql_user                 = DB_USER

        sql_pass                 = DB_PASSWORD

        sql_db                   = DB_NAME

        sql_port                 = 3306  # optional, default is 3306

        sql_query_pre            = SET NAMES utf8

        sql_query                =  SELECT id, 1 AS group_id, title, pub_time,  content FROM table_1   查询表 #sql_query第一列id需为整数

        sql_attr_uint                   = group_id  group_id 为表的标识 必须为整数

        #sql_attr_timestamp              = pub_time  #从SQL读取到的值必须为整数,作为时间属性 直接注释掉

        sql_query_info                  = SELECT * FROM contents WHERE id=$id  #命令行查询时,从数据库读取原始数据信息  可以注释 多表查询 sql_query_info                  = SELECT * WHERE ID=$id 

}

source table_2 : tbale_1         table_2 继承table_1的配置   重新加载

{

 sql_query = SELECT id, 2 AS group_id, vcName,vcFullName FROM table_2

}

index table_1

{

        source                = table_1 #对应的source名称

        path          = /usr/local/coreseek/var/data/table_1  #必须为绝对路径

        docinfo               = extern

        charset_dictpath       = /usr/local/mmseg3/etc/

        charset_type           = zh_cn.utf-8

        ngram_len              = 0

enable_star = 0    min_infix_len = 1   #配置文件默认不支持模糊查询  添加这两个字段 支持模糊查询  

  infix_fields = OrgName,vcName  #设置要搜索的字段

}

index table_2 : table_1  table_2 继承table_1的配置   重新加载

{

 source = table_2

 path            = /usr/local/coreseek/var/data/table_2

 enable_star = 0    min_infix_len = 1   #配置文件默认不支持模糊查询  添加这两个字段 支持模糊查询 

 infix_fields = OrgName,vcName  #设置要搜索的字段

}

indexer

{

        mem_limit               = 198M

}

searchd

{

        port                 = 9312

        log        = /usr/local/coreseek/var/log/searchd.log  #必须为绝对路径

        query_log      = /usr/local/coreseek/var/log/query.log #必须为绝对路径

        read_timeout         = 5

        max_children         = 30

        pid_file      = /usr/local/coreseek/var/log/searchd.pid #必须为绝对路径

        max_matches         = 1000

        seamless_rotate       = 1

        preopen_indexes      = 1

        unlink_old             = 1

}

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: