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

     

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 ..

1.png

2.png

3.png



 

 

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

}

 


 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Sphinx 是一个在GPLv2 下发布的一个全文检索引擎,商业授权(例如, 嵌入到其他程序中)需要联系我们(Sphinxsearch.com)以获得商业授权。 一般而言,Sphinx是一个独立的搜索引擎,意图为其他应用提供高速、低空间占用、高结果相关度的全文搜索功能。Sphinx可以非常容易的与SQL数据库和脚本语言集成。 当前系统内置MySQL和PostgreSQL 数据库数据源的支持,也支持从标准输入读取特定格式的XML数据。通过修改源代码,用户可以自行增加新的数据源(例如:其他类型的DBMS 的原生支持)。 搜索API支持PHP、Python、Perl、Rudy和Java,并且也可以用作MySQL存储引擎。搜索API非常简单,可以在若干个小时之内移植到新的语言上。 Sphinx 是SQL Phrase Index的缩写,但不幸的和CMU的Sphinx 目录 1. 简介 1.1. 什么是 Sphinx 1.2. Sphinx 的特性 1.3. 如何获得 Sphinx 1.4. 许可协议 1.5. 作者和贡献者 1.6. 开发历史 2. 安装 2.1. 支持的操作系统 2.2. 依赖的工具 2.3. 安装 Sphinx 2.4. 已知的问题和解决方法 2.5. Sphinx 快速入门教程 3. 建立索引 3.1. 数据源 3.2. 属性 3.3. 多值属性 ( MVA : multi-valued attributes) 3.4. 索引 3.5. 数据源的限制 3.6. 字符集 , 大小写转换 , 和转换表 3.7. SQL 数据源 (MySQL, PostgreSQL) 3.8. xmlpipe 数据源 3.9. xmlpipe2 数据源 3.10. 实时索引 更新 3.11. 索引合并 4. 搜索 4.1. 匹配模式 4.2. 布尔查询 4.3. 扩展查询 4.4. 权值计算 4.5. 排序模式 4.6. 结果分组(聚类) 4.7. 分布式搜索 4.8. searchd 日志格式 5. API 参考 5.1. 通用 API 方法 5.1.1. GetLastError 5.1.2. GetLastWarning 5.1.3. SetServer 5.1.4. SetRetries 5.1.5. SetArrayResult 5.2. 通用搜索设置 5.2.1. SetLimits 5.2.2. SetMaxQueryTime 5.3. 全文搜索设置 5.3.1. SetMatchMode 5.3.2. SetRankingMode 5.3.3. SetSortMode 5.3.4. SetWeights 5.3.5. SetFieldWeights 5.3.6. SetIndexWeights 5.4. 结果集过滤设置 5.4.1. SetIDRange 5.4.2. SetFilter 5.4.3. SetFilterRange 5.4.4. SetFilterFloatRange 5.4.5. SetGeoAnchor 5.5. GROUP BY 设置 5.5.1. SetGroupBy 5.5.2. SetGroupDistinct 5.6. 搜索 5.6.1. Query 5.6.2. AddQuery 5.6.3. RunQueries 5.6.4. ResetFilters 5.6.5. ResetGroupBy 5.7. 额外的方法 5.7.1. BuildExcerpts 5.7.2. UpdateAttributes 6. MySQL 存储引擎 (SphinxSE) 6.1. SphinxSE 概览 6.2. 安装 SphinxSE 6.2.1. 在 MySQL 5.0.x 上 编译 SphinxSE 6.2.2. 在 MySQL 5.1.x 上编译 SphinxSE 6.2.3. SphinxSE 安装测试 6.3. 使用 SphinxSE 7. 报告 bugs 8. sphinx.conf 选项参考 8.1. Data source 配置选项 8.1.1. type 8.1.2. sql_host 8.1.3. sql_port 8.1.4. sql_user 8.1.5. sql_pass 8.1.6. sql_db 8.1.7. sql_sock 8.1.8. mysql_connect_flags 8.1.9. sql_query_pre 8.1.10. sql_query 8.1.11. sql_query_range 8.1.12. sql_range_step 8.1.13. sql_attr_uint 8.1.14. sql_attr_bool 8.1.15. sql_attr_timestamp 8.1.16. sql_attr_str2ordinal 8.1.17. sql_attr_float 8.1.18. sql_attr_multi 8.1.19. sql_query_post 8.1.20. sql_query_post_index 8.1.21. sql_ranged_throttle 8.1.22. sql_query_info 8.1.23. xmlpipe_command 8.1.24. xmlpipe_field 8.1.25. xmlpipe_attr_uint 8.1.26. xmlpipe_attr_bool 8.1.27. xmlpipe_attr_timestamp 8.1.28. xmlpipe_attr_str2ordinal 8.1.29. xmlpipe_attr_float 8.1.30. xmlpipe_attr_multi 8.2. 索引配置选项 8.2.1. type 8.2.2. source 8.2.3. path 8.2.4. docinfo 8.2.5. mlock 8.2.6. morphology 8.2.7. stopwords 8.2.8. wordforms 8.2.9. exceptions 8.2.10. min_word_len 8.2.11. charset_type 8.2.12. charset_table 8.2.13. ignore_chars 8.2.14. min_prefix_len 8.2.15. min_infix_len 8.2.16. prefix_fields 8.2.17. infix_fields 8.2.18. enable_star 8.2.19. ngram_len 8.2.20. ngram_chars 8.2.21. phrase_boundary 8.2.22. phrase_boundary_step 8.2.23. html_strip 8.2.24. html_index_attrs 8.2.25. html_remove_elements 8.2.26. local 8.2.27. agent 8.2.28. agent_connect_timeout 8.2.29. agent_query_timeout 8.2.30. preopen 8.2.31. charset_dictpath 8.3. indexer 程序配置选项 8.3.1. mem_limit 8.3.2. max_iops 8.3.3. max_iosize 8.4. searchd 程序配置选项
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值