安装sphinx、coreseek

霸气de小男生 提交于 2019-12-03 05:48:03

wget http://sphinxsearch.com/files/sphinx-2.2.10-release.tar.gz

tar -zxvf sphinx-2.2.10-release.tar.gz

cd sphinx-2.2.10-release

sh configure  --prefix=/usr/local/sphinx

make && make install



wget http://www.coreseek.cn/uploads/csft/4.0/coreseek-4.1-beta.tar.gz

tar -zxvf coreseek-4.1-beta.tar.gz

cd coreseek-4.1-beta

cd mmseg-3.2.14

sh configure --prefix=/usr/local/mmseg

如果报错config.status: error: cannot find input file: src/Makefile.in执行以下命令

aclocal
libtoolize --force
automake --add-missing
autoconf
autoheader
make clean

make && make install

cd ..

cd csft-4.1

sh buildconf.sh

./configure --prefix=/usr/local/coreseek  --without-unixodbc --with-mmseg --with-mmseg-includes=/usr/local/mmseg/include/mmseg/ --with-mmseg-libs=/usr/local/mmseg/lib/ --with-mysql

make && make install


cd /usr/local/coreseek

vi sphinx.conf

source src1
{
        type                    = mysql

        sql_host                = 35.35.0.1
        sql_user                = root
        sql_pass                = 密码
        sql_db                  = erp
        sql_port                = 3306  # optional, default is 3306

        sql_query_pre           = SET NAMES utf8
        sql_query_pre           = SET SESSION query_cache_type=OFF

        sql_query               = select id,model,user_id,action_ip,remark,create_time from ot_action_log
        sql_field_string = remark
        sql_attr_timestamp = create_time

        sql_query_info          = SELECT * FROM ot_action_log WHERE id=$id
}

source src1throttled : src1
{
        sql_ranged_throttle     = 100
}

index test1
{
        source                  = src1
        path                    = /home/data/test1
        docinfo                 = extern
        mlock                   = 0
        morphology              = none
        min_word_len            = 1
        charset_type = zh_cn.utf-8
        charset_dictpath  = /usr/local/mmseg/etc/
        html_strip              = 0
}



indexer
{
        mem_limit               = 256M
}

searchd
{
        listen                  = 9312

        log                     = /home/data/searchd.log
        query_log               = /home/data/query.log
        read_timeout            = 5
        client_timeout          = 300
        max_children            = 30
        pid_file                = /home/data/searchd.pid
        max_matches             = 1000
        seamless_rotate         = 1
        preopen_indexes         = 1
        unlink_old              = 1
        mva_updates_pool        = 1M
        max_packet_size         = 8M
        max_filters             = 256
        max_filter_values       = 4096
}

/usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/sphinx.conf test1

PS:如果报错“ERROR: index 'main': sql_query_pre[1]: Query cache is disabled; restart the server with query_cache_type=1 to enable it

vi /etc/my.cnf
添加
query_cache_size = 268435456
query_cache_type = 1
query_cache_limit = 1048576

service mysql restart


/usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/sphinx.conf


拷贝api文件 coreseek-4.1-beta/csft-4.1/api/sphinxapi.php

vi test.php

<?php
header('Content-Type: text/html; charset=utf-8');
require ( "sphinxapi.php" );

$cl = new SphinxClient ();
$cl->SetServer ( '35.35.0.1', 9312);
$cl->SetArrayResult ( true );
$cl->SetMatchMode ( SPH_MATCH_ALL );
var_dump($cl->Query ( '丹', 'test1'));
?>



参考资料:

coreseek实时索引全文搜索 http://blog.csdn.net/ns2250225/article/details/43877419

coreseek 增量索引模拟实时索引 http://blog.csdn.net/liushuai_andy/article/details/9138455  

coreseek 词库更改 http://blog.csdn.net/liushuai_andy/article/details/9129655

sphinx coreseek 多字段进行and查询  http://blog.csdn.net/liushuai_andy/article/details/16115195

关于多属性查找问题的sphinx解决方案

http://www.cnblogs.com/littlehb/p/3667821.html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!