Onex ecstore中sphinx安装及调试(完整版)

/ 0评 / 3

1.安装sphinx(2016/11/27最新教程)

by-xiao酱沫

@Author:  875358601@qq.com @DateTime:  2016-11-27 21:24:40

详情可参考:https://jinjiajin.net/ecos/append-c/sphinx-2.html


wget http://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz
tar zxvf sphinx-2.2.11-release.tar.gz
cd sphinx-2.2.11-release
mkdir /usr/local/shinx
./configure --prefix=/usr/local/sphinx --with-mysql=/usr/local/mysql/
make && make install

注释:
--prefix : 指定Sphinx安装到何处,我的安装目录是“/usr/local/sphinx”
--with-mysql : mysql的安装目录,我的安装目录是“/usr/local/mysql/”

运行# searchd命令:如看到以下信息则表示安装成功


[root@localhost bin]# searchd
Sphinx 2.0.8-release (r3831)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

FATAL: no readable config file (looked in /usr/local/sphinx/etc/sphinx.conf, ./sphinx.conf).

如果提示没有当前的命令,是因为sphinx默认安装没有将 /usr/local/sphinx/bin放在环境变量中。

将/usr/local/sphinx/bin添加到环境变量的操作方法如下:


[root@localhost bin]# vi /etc/profile
打开此文件,在文件末尾添加以下代码:
PATH=$PATH:/usr/local/sphinx/bin
export PATH
然后运行 [root@localhost bin]# echo $PATH 查看是否添加成功!

或者


ln -s /usr/local/sphinx/bin/* /usr/bin/

2.配置config.php以及sphinx.conf

vim config.php


#sphinx 配置
#sphinx默认调用地址为127.0.0.1:9306
#define('SPHINX_SERVER_HOST', '127.0.0.1:9306');
#define('SPHINX_PCONNECT',1); #是否启用sphinx持续连接?

cp /data/httpd/www/ecstore/app/search/config/sphinx.conf /usr/local/sphinx/etc/sphinx.conf


[root@localhost acgcss]#vim /usr/local/sphinx/etc/sphinx.conf
source b2c_goods
{
        type                    = mysql
        sql_host                = 127.0.0.1
        sql_user                = test
        sql_pass                = test123
        sql_db                  = test
        sql_port                = 3306  # optional, default is 3306

        sql_query_pre           = SET NAMES utf8

        sql_query = SELECT goods_id,goods_type,type_id,cat_id,brand_id,nostore_sell,price,store,name,brief,bn,p_order,d_order,if(marketable='true',1,0) as marketable,disabled, \
    last_modify,p_1,p_2,p_3,p_4,p_5,p_6,p_7,p_8,p_9,p_10,p_11,p_12,p_13,p_14,p_15,p_16,p_17,p_18,p_19,p_20,comments_count,view_w_count,view_count,buy_count,buy_w_count \
    FROM sdb_b2c_goods  where disabled='false'

        sql_joined_field =  cats from query;select goods_id,CONCAT(g.cat_id,c.cat_path,cat_name) from sdb_b2c_goods_cat as c left join sdb_b2c_goods as g on g.cat_id=c.cat_id order by goods_id asc
    sql_joined_field = brand_name from query;SELECT goods_id,CONCAT(b.brand_name,b.brand_keywords) from sdb_b2c_brand as b left join sdb_b2c_goods as g on g.brand_id=b.brand_id order by goods_id  asc
        #sql_attr_bool = nostore_sell
        sql_attr_uint = marketable
        #sql_attr_uint = goods_id
        sql_attr_uint = cat_id
        sql_attr_uint = type_id
        sql_attr_uint = brand_id
        sql_attr_float = price
        sql_attr_float = store
        sql_attr_multi  = uint spec_value_id from query; SELECT goods_id, spec_value_id FROM sdb_b2c_goods_spec_index
        sql_attr_multi  = uint spec_id from query; SELECT goods_id, spec_id FROM sdb_b2c_goods_spec_index
        sql_attr_uint = p_1
        sql_attr_uint = p_2
        sql_attr_uint = p_3
        sql_attr_uint = p_4
        sql_attr_uint = p_5
        sql_attr_uint = p_6
        sql_attr_uint = p_7
        sql_attr_uint = p_8
        sql_attr_uint = p_9
        sql_attr_uint = p_10
        sql_attr_uint = p_11
        sql_attr_uint = p_12
        sql_attr_uint = p_13
        sql_attr_uint = p_14
        sql_attr_uint = p_15
        sql_attr_uint = p_16
        sql_attr_uint = p_17
        sql_attr_uint = p_18
        sql_attr_uint = p_19
        sql_attr_uint = p_20
    sql_attr_multi  = uint is_store from query;select goods_id,1 is true as is_store from sdb_b2c_goods where nostore_sell='1' or store>0

    #属性搜索
    sql_joined_field = p_1_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_1=p.props_value_id where p_1 is not null order by g.goods_id asc
    sql_joined_field = p_2_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_2=p.props_value_id where p_2 is not null order by g.goods_id asc
    sql_joined_field = p_3_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_3=p.props_value_id where p_3 is not null order by g.goods_id asc
    sql_joined_field = p_4_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_4=p.props_value_id where p_4 is not NULL order by g.goods_id asc
    sql_joined_field = p_5_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_5=p.props_value_id where p_5 is not NULL order by g.goods_id asc
    sql_joined_field = p_6_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_6=p.props_value_id where p_6 is not NULL order by g.goods_id asc
    sql_joined_field = p_7_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_7=p.props_value_id where p_7 is not NULL order by g.goods_id asc
    sql_joined_field = p_8_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_8=p.props_value_id where p_8 is not NULL order by g.goods_id asc
    sql_joined_field = p_9_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_9=p.props_value_id where p_9 is not NULL order by g.goods_id asc
    sql_joined_field = p_10_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_10=p.props_value_id where p_10 is not  NULL order by g.goods_id asc
    sql_joined_field = p_11_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_11=p.props_value_id where p_11 is not  NULL order by g.goods_id asc
    sql_joined_field = p_12_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_12=p.props_value_id where p_12 is not  NULL order by g.goods_id asc
    sql_joined_field = p_13_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_13=p.props_value_id where p_13 is not  NULL order by g.goods_id asc
    sql_joined_field = p_14_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_14=p.props_value_id where p_14 is not  NULL order by g.goods_id asc
    sql_joined_field = p_15_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_15=p.props_value_id where p_15 is not  NULL order by g.goods_id asc
    sql_joined_field = p_16_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_16=p.props_value_id where p_16 is not  NULL order by g.goods_id asc
    sql_joined_field = p_17_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_17=p.props_value_id where p_17 is not  NULL order by g.goods_id asc
    sql_joined_field = p_18_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_18=p.props_value_id where p_18 is not  NULL order by g.goods_id asc
    sql_joined_field = p_19_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_19=p.props_value_id where p_19 is not  NULL order by g.goods_id asc
    sql_joined_field = p_20_props_name from query; select goods_id,p.name from sdb_b2c_goods as g left join sdb_b2c_goods_type_props_value as p on g.p_20=p.props_value_id where p_20 is not  NULL order by g.goods_id asc

    sql_attr_uint = view_w_count
    sql_attr_uint = comments_count
    sql_attr_uint = view_count
    sql_attr_uint = buy_count
    sql_attr_uint = buy_w_count
        sql_attr_uint = p_order
        sql_attr_uint = d_order
        sql_attr_uint = last_modify
        sql_attr_multi  =  uint tag_id from query; SELECT rel_id,tag_id FROM sdb_desktop_tag_rel WHERE app_id='b2c' AND tag_type = 'goods'
        sql_attr_multi  = uint product_id from query; SELECT goods_id, product_id FROM sdb_b2c_products

    sql_joined_field = product_bn from query; SELECT goods_id ,bn FROM sdb_b2c_products ORDER BY goods_id ASC
    sql_joined_field = keyword from query;SELECT goods_id,keyword FROM sdb_b2c_goods_keywords

        sql_attr_bool = disabled
        sql_ranged_throttle     = 0
        #sql_query_info         = SELECT * FROM sdb_b2c_goods WHERE goods_id=$id
}

source b2c_goods_delta:b2c_goods
{
    type                        = mysql
        sql_host                = 127.0.0.1
        sql_user                = test
        sql_pass                = test123
        sql_db                  = test
        sql_port                = 3306  # optional, default is 3306

        sql_query_pre           = SET NAMES utf8

        sql_query = SELECT goods_id,goods_type,G.type_id as type_id,cat_id,G.brand_id,nostore_sell,price,G.store as store,G.name,G.brief,G.bn,p_order,d_order,if(marketable='true',1,0) as marketable,G.disabled, \
    G.last_modify,p_1,p_2,p_3,p_4,p_5,p_6,p_7,p_8,p_9,p_10,p_11,p_12,p_13,p_14,p_15,p_16,p_17,p_18,p_19,p_20,G.comments_count,view_w_count,view_count,buy_count,buy_w_count \
    FROM sdb_search_delta as d left join sdb_b2c_goods as G on d.id=G.goods_id  where index_name='b2c_goods'

        sql_joined_field =  cats from query;select goods_id,CONCAT(g.cat_id,c.cat_path,cat_name) from sdb_b2c_goods_cat as c left join sdb_b2c_goods as g on g.cat_id=c.cat_id \
    where g.last_modify>unix_timestamp()-86400 order by goods_id asc
    sql_joined_field = brand_name from query;SELECT goods_id,CONCAT(b.brand_name,b.brand_keywords) from sdb_b2c_brand as b left join sdb_b2c_goods as g on g.brand_id=b.brand_id \
    where g.last_modify>unix_timestamp()-86400 order by goods_id  asc
        #sql_attr_bool = nostore_sell
        sql_attr_uint = marketable
        #sql_attr_uint = goods_id
        sql_attr_uint = cat_id
        sql_attr_uint = type_id
        sql_attr_uint = brand_id
        sql_attr_float = price
        sql_attr_float = store
        sql_attr_multi  = uint spec_value_id from query; SELECT goods_id, spec_value_id FROM sdb_b2c_goods_spec_index where last_modify > unix_timestamp() - 86400
        sql_attr_multi  = uint spec_id from query; SELECT goods_id, spec_id FROM sdb_b2c_goods_spec_index where last_modify > unix_timestamp() -86400
        sql_attr_uint = p_1
        sql_attr_uint = p_2
        sql_attr_uint = p_3
        sql_attr_uint = p_4
        sql_attr_uint = p_5
        sql_attr_uint = p_6
        sql_attr_uint = p_7
        sql_attr_uint = p_8
        sql_attr_uint = p_9
        sql_attr_uint = p_10
        sql_attr_uint = p_11
        sql_attr_uint = p_12
        sql_attr_uint = p_13
        sql_attr_uint = p_14
        sql_attr_uint = p_15
        sql_attr_uint = p_16
        sql_attr_uint = p_17
        sql_attr_uint = p_18
        sql_attr_uint = p_19
        sql_attr_uint = p_20
    sql_attr_multi  = uint is_store from query;select id,1 is true as is_store from sdb_search_delta as D left join sdb_b2c_goods as g on D.id=g.goods_id where nostore_sell='1' or store>0

    #属性搜索
    sql_joined_field = p_1_props_name from query; select goods_id,p.name from sdb_search_delta as d left join sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_1=p.props_value_id where p_1 is not null        and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_2_props_name from query; select goods_id,p.name from sdb_search_delta as d left join sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_2=p.props_value_id where p_2 is not null        and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_3_props_name from query; select goods_id,p.name from sdb_search_delta as d left join sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_3=p.props_value_id where p_3 is not null        and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_4_props_name from query; select goods_id,p.name from sdb_search_delta as d left join sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_4=p.props_value_id where p_4 is not NULL        and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_5_props_name from query; select goods_id,p.name from sdb_search_delta as d left join sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_5=p.props_value_id where p_5 is not NULL        and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_6_props_name from query; select goods_id,p.name from sdb_search_delta as d left join sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_6=p.props_value_id where p_6 is not NULL        and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_7_props_name from query; select goods_id,p.name from sdb_search_delta as d left join sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_7=p.props_value_id where p_7 is not NULL        and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_8_props_name from query; select goods_id,p.name from sdb_search_delta as d left join sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_8=p.props_value_id where p_8 is not NULL        and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_9_props_name from query; select goods_id,p.name from sdb_search_delta as d left join sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_9=p.props_value_id where p_9 is not NULL        and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_10_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_10=p.props_value_id where p_10 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc/*{{{*/
    sql_joined_field = p_11_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_11=p.props_value_id where p_11 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_12_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_12=p.props_value_id where p_12 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_13_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_13=p.props_value_id where p_13 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_14_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_14=p.props_value_id where p_14 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_15_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_15=p.props_value_id where p_15 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_16_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_16=p.props_value_id where p_16 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_17_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_17=p.props_value_id where p_17 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_18_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_18=p.props_value_id where p_18 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_19_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_19=p.props_value_id where p_19 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc
    sql_joined_field = p_20_props_name from query; select goods_id,p.name from sdb_search_delta as d  left join  sdb_b2c_goods as g on d.id=g.goods_id left join sdb_b2c_goods_type_props_value as p on g.p_20=p.props_value_id where p_20 is not  NULL  and lastmodify>unix_timestamp()-86400  order by g.goods_id asc/*}}}*/

    sql_attr_uint = view_w_count
    sql_attr_uint = comments_count
    sql_attr_uint = view_count
    sql_attr_uint = buy_count
    sql_attr_uint = buy_w_count
    sql_attr_uint = p_order
    sql_attr_uint = d_order
    sql_attr_uint = last_modify
    sql_attr_multi  =  uint tag_id from query; SELECT rel_id,tag_id FROM sdb_desktop_tag_rel WHERE app_id='b2c' AND tag_type = 'goods' AND last_modify>unix_timestamp()-86400
    #sql_attr_multi = uint product_id from query; SELECT goods_id, product_id FROM sdb_b2c_products

    sql_joined_field = product_bn from query; SELECT goods_id ,bn FROM sdb_b2c_products WHERE last_modify>unix_timestamp()-86400 ORDER BY goods_id ASC
    sql_joined_field = keyword from query;SELECT goods_id,keyword FROM sdb_b2c_goods_keywords WHERE last_modify>unix_timestamp()-86400

    sql_attr_bool = disabled
    sql_ranged_throttle = 0
    #sql_query_info = SELECT * FROM sdb_b2c_goods WHERE goods_id=$id

}

index b2c_goods_merge
{
    source       = b2c_goods
    path         = /usr/local/sphinx/var/data/b2c_goods
    docinfo      = extern
    mlock        = 0
    min_word_len = 1
    charset_type = utf-8
    charset_table = U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z,A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6,U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101,U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109,U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F,U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117,U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D,U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135,U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C,U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144,U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B,U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153,U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159,U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161,U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167,U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F,U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175,U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C,U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F,U+05D0..U+05EA, U+0531..U+0556->U+0561..U+0586, U+0561..U+0587, U+0621..U+063A, U+01B9,U+01BF, U+0640..U+064A, U+0660..U+0669, U+066E, U+066F, U+0671..U+06D3, U+06F0..U+06FF,U+0904..U+0939, U+0958..U+095F, U+0960..U+0963, U+0966..U+096F, U+097B..U+097F,U+0985..U+09B9, U+09CE, U+09DC..U+09E3, U+09E6..U+09EF, U+0A05..U+0A39, U+0A59..U+0A5E,U+0A66..U+0A6F, U+0A85..U+0AB9, U+0AE0..U+0AE3, U+0AE6..U+0AEF, U+0B05..U+0B39,U+0B5C..U+0B61, U+0B66..U+0B6F, U+0B71, U+0B85..U+0BB9, U+0BE6..U+0BF2, U+0C05..U+0C39,U+0C66..U+0C6F, U+0C85..U+0CB9, U+0CDE..U+0CE3, U+0CE6..U+0CEF, U+0D05..U+0D39, U+0D60,U+0D61, U+0D66..U+0D6F, U+0D85..U+0DC6, U+1900..U+1938, U+1946..U+194F, U+A800..U+A805,U+A807..U+A822, U+0386->U+03B1, U+03AC->U+03B1, U+0388->U+03B5, U+03AD->U+03B5,U+0389->U+03B7, U+03AE->U+03B7, U+038A->U+03B9, U+0390->U+03B9, U+03AA->U+03B9,U+03AF->U+03B9, U+03CA->U+03B9, U+038C->U+03BF, U+03CC->U+03BF, U+038E->U+03C5,U+03AB->U+03C5, U+03B0->U+03C5, U+03CB->U+03C5, U+03CD->U+03C5, U+038F->U+03C9,U+03CE->U+03C9, U+03C2->U+03C3, U+0391..U+03A1->U+03B1..U+03C1,U+03A3..U+03A9->U+03C3..U+03C9, U+03B1..U+03C1, U+03C3..U+03C9, U+0E01..U+0E2E,U+0E30..U+0E3A, U+0E40..U+0E45, U+0E47, U+0E50..U+0E59, U+A000..U+A48F, U+4E00..U+9FBF,U+3400..U+4DBF, U+20000..U+2A6DF, U+F900..U+FAFF, U+2F800..U+2FA1F, U+2E80..U+2EFF,U+2F00..U+2FDF, U+3100..U+312F, U+31A0..U+31BF, U+3040..U+309F, U+30A0..U+30FF,U+31F0..U+31FF, U+AC00..U+D7AF, U+1100..U+11FF, U+3130..U+318F, U+A000..U+A48F,U+A490..U+A4CF
    ngram_len = 1
    ngram_chars = U+4E00..U+9FBF, U+3400..U+4DBF, U+20000..U+2A6DF, U+F900..U+FAFF,U+2F800..U+2FA1F, U+2E80..U+2EFF, U+2F00..U+2FDF, U+3100..U+312F, U+31A0..U+31BF,U+3040..U+309F, U+30A0..U+30FF, U+31F0..U+31FF, U+AC00..U+D7AF, U+1100..U+11FF,U+3130..U+318F, U+A000..U+A48F, U+A490..U+A4CF
    html_strip = 1
}

index b2c_goods_delta
{
        source      = b2c_goods_delta
        path        = /usr/local/sphinx/var/data/b2c_goods_delta
        docinfo     = extern
        mlock       = 0
    min_word_len    = 1
        charset_type    = utf-8
    charset_table = U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z,A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6,U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101,U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109,U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F,U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117,U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D,U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135,U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C,U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144,U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B,U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153,U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159,U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161,U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167,U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F,U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175,U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C,U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F,U+05D0..U+05EA, U+0531..U+0556->U+0561..U+0586, U+0561..U+0587, U+0621..U+063A, U+01B9,U+01BF, U+0640..U+064A, U+0660..U+0669, U+066E, U+066F, U+0671..U+06D3, U+06F0..U+06FF,U+0904..U+0939, U+0958..U+095F, U+0960..U+0963, U+0966..U+096F, U+097B..U+097F,U+0985..U+09B9, U+09CE, U+09DC..U+09E3, U+09E6..U+09EF, U+0A05..U+0A39, U+0A59..U+0A5E,U+0A66..U+0A6F, U+0A85..U+0AB9, U+0AE0..U+0AE3, U+0AE6..U+0AEF, U+0B05..U+0B39,U+0B5C..U+0B61, U+0B66..U+0B6F, U+0B71, U+0B85..U+0BB9, U+0BE6..U+0BF2, U+0C05..U+0C39,U+0C66..U+0C6F, U+0C85..U+0CB9, U+0CDE..U+0CE3, U+0CE6..U+0CEF, U+0D05..U+0D39, U+0D60,U+0D61, U+0D66..U+0D6F, U+0D85..U+0DC6, U+1900..U+1938, U+1946..U+194F, U+A800..U+A805,U+A807..U+A822, U+0386->U+03B1, U+03AC->U+03B1, U+0388->U+03B5, U+03AD->U+03B5,U+0389->U+03B7, U+03AE->U+03B7, U+038A->U+03B9, U+0390->U+03B9, U+03AA->U+03B9,U+03AF->U+03B9, U+03CA->U+03B9, U+038C->U+03BF, U+03CC->U+03BF, U+038E->U+03C5,U+03AB->U+03C5, U+03B0->U+03C5, U+03CB->U+03C5, U+03CD->U+03C5, U+038F->U+03C9,U+03CE->U+03C9, U+03C2->U+03C3, U+0391..U+03A1->U+03B1..U+03C1,U+03A3..U+03A9->U+03C3..U+03C9, U+03B1..U+03C1, U+03C3..U+03C9, U+0E01..U+0E2E,U+0E30..U+0E3A, U+0E40..U+0E45, U+0E47, U+0E50..U+0E59, U+A000..U+A48F, U+4E00..U+9FBF,U+3400..U+4DBF, U+20000..U+2A6DF, U+F900..U+FAFF, U+2F800..U+2FA1F, U+2E80..U+2EFF,U+2F00..U+2FDF, U+3100..U+312F, U+31A0..U+31BF, U+3040..U+309F, U+30A0..U+30FF,U+31F0..U+31FF, U+AC00..U+D7AF, U+1100..U+11FF, U+3130..U+318F, U+A000..U+A48F,U+A490..U+A4CF
    ngram_len = 1
    ngram_chars = U+4E00..U+9FBF, U+3400..U+4DBF, U+20000..U+2A6DF, U+F900..U+FAFF,U+2F800..U+2FA1F, U+2E80..U+2EFF, U+2F00..U+2FDF, U+3100..U+312F, U+31A0..U+31BF,U+3040..U+309F, U+30A0..U+30FF, U+31F0..U+31FF, U+AC00..U+D7AF, U+1100..U+11FF,U+3130..U+318F, U+A000..U+A48F, U+A490..U+A4CF
    html_strip = 1
}

index b2c_goods
{
    type =  distributed
    local = b2c_goods_delta
    local = b2c_goods_merge
}

source search_associate
{
    type                        = mysql
        sql_host                = 127.0.0.1
        sql_user                = test
        sql_pass                = test123
        sql_db                  = test
        sql_port                = 3306  # optional, default is 3306

        sql_query_pre           = SET NAMES utf8
        sql_query = select id,words from sdb_search_associate group by words
}

index search_associate
{
    source = search_associate
    path = /usr/local/sphinx/var/data/search_associate
    docinfo = extern
    mlock = 0
    min_word_len    = 1
    charset_type    = utf-8
    charset_table   = U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z,A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6,U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101,U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109,U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F,U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117,U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D,U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135,U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C,U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144,U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B,U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153,U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159,U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161,U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167,U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F,U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175,U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C,U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F,U+05D0..U+05EA, U+0531..U+0556->U+0561..U+0586, U+0561..U+0587, U+0621..U+063A, U+01B9,U+01BF, U+0640..U+064A, U+0660..U+0669, U+066E, U+066F, U+0671..U+06D3, U+06F0..U+06FF,U+0904..U+0939, U+0958..U+095F, U+0960..U+0963, U+0966..U+096F, U+097B..U+097F,U+0985..U+09B9, U+09CE, U+09DC..U+09E3, U+09E6..U+09EF, U+0A05..U+0A39, U+0A59..U+0A5E,U+0A66..U+0A6F, U+0A85..U+0AB9, U+0AE0..U+0AE3, U+0AE6..U+0AEF, U+0B05..U+0B39,U+0B5C..U+0B61, U+0B66..U+0B6F, U+0B71, U+0B85..U+0BB9, U+0BE6..U+0BF2, U+0C05..U+0C39,U+0C66..U+0C6F, U+0C85..U+0CB9, U+0CDE..U+0CE3, U+0CE6..U+0CEF, U+0D05..U+0D39, U+0D60,U+0D61, U+0D66..U+0D6F, U+0D85..U+0DC6, U+1900..U+1938, U+1946..U+194F, U+A800..U+A805,U+A807..U+A822, U+0386->U+03B1, U+03AC->U+03B1, U+0388->U+03B5, U+03AD->U+03B5,U+0389->U+03B7, U+03AE->U+03B7, U+038A->U+03B9, U+0390->U+03B9, U+03AA->U+03B9,U+03AF->U+03B9, U+03CA->U+03B9, U+038C->U+03BF, U+03CC->U+03BF, U+038E->U+03C5,U+03AB->U+03C5, U+03B0->U+03C5, U+03CB->U+03C5, U+03CD->U+03C5, U+038F->U+03C9,U+03CE->U+03C9, U+03C2->U+03C3, U+0391..U+03A1->U+03B1..U+03C1,U+03A3..U+03A9->U+03C3..U+03C9, U+03B1..U+03C1, U+03C3..U+03C9, U+0E01..U+0E2E,U+0E30..U+0E3A, U+0E40..U+0E45, U+0E47, U+0E50..U+0E59, U+A000..U+A48F, U+4E00..U+9FBF,U+3400..U+4DBF, U+20000..U+2A6DF, U+F900..U+FAFF, U+2F800..U+2FA1F, U+2E80..U+2EFF,U+2F00..U+2FDF, U+3100..U+312F, U+31A0..U+31BF, U+3040..U+309F, U+30A0..U+30FF,U+31F0..U+31FF, U+AC00..U+D7AF, U+1100..U+11FF, U+3130..U+318F, U+A000..U+A48F,U+A490..U+A4CF
    ngram_len = 1
    ngram_chars     = U+4E00..U+9FBF, U+3400..U+4DBF, U+20000..U+2A6DF, U+F900..U+FAFF,U+2F800..U+2FA1F, U+2E80..U+2EFF, U+2F00..U+2FDF, U+3100..U+312F, U+31A0..U+31BF,U+3040..U+309F, U+30A0..U+30FF, U+31F0..U+31FF, U+AC00..U+D7AF, U+1100..U+11FF,U+3130..U+318F, U+A000..U+A48F, U+A490..U+A4CF
    html_strip = 1
}

indexer
{
        mem_limit               = 1024M
}

searchd
{
        listen                  = 9312
        listen          = 9306:mysql41
        log                     = /usr/local/sphinx/var/log/searchd.log
        query_log               = /usr/local/sphinx/var/log/query.log
        read_timeout            = 5
        client_timeout          = 90
        max_children            = 400
        pid_file                = /usr/local/sphinx/var/log/searchd.pid
        max_matches             = 100000000
        seamless_rotate         = 1
        preopen_indexes         = 0
        unlink_old              = 1
        mva_updates_pool        = 1M
        max_packet_size         = 8M
        max_filters             = 256
        max_filter_values       = 4096
        dist_threads = 2
        #workers = threads # for RT to work
}
# --eof--

4.查看是否配置成功
在更新索引之前需要先安装search 和searchrule两个app,并且是启用状态
否则会在建立索引的时候报找不到对应的数据表


#更新索引,如果sphingx配置文件放在自定义目录 使用--config 指定
[root@centos44 bin]# indexer --all --rotate
Sphinx 2.0.8-release (r3831)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (https://sphinxsearch.com)

using config file '/usr/local/sphinx/etc/sphinx.conf'...
indexing index 'b2c_goods_merge'...
collected 20160 docs, 3.9 MB
collected 562282 attr values
sorted 0.6 Mvalues, 100.0% done
sorted 0.8 Mhits, 100.0% done
total 20160 docs, 3894397 bytes
total 1.696 sec, 2295645 bytes/sec, 11883.79 docs/sec
indexing index 'b2c_goods_delta'...
collected 0 docs, 0.0 MB
collected 0 attr values
sorted 0.0 Mvalues, 100.0% done
total 0 docs, 14 bytes
total 0.142 sec, 98 bytes/sec, 0.00 docs/sec
skipping non-plain index 'b2c_goods'...
indexing index 'search_associate'...
WARNING: Attribute count is 0: switching to none docinfo
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.002 sec, 0 bytes/sec, 0.00 docs/sec
total 356208 reads, 0.127 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 35 writes, 0.024 sec, 762.6 kb/call avg, 0.6 msec/call avg
rotating indices: successfully sent SIGHUP to searchd (pid=18632).

5.启动sphinx


app/search/config/build_main_index.sh
提示:在启动时,也许会有mysql的报错,根据提示解决问题即
可常见报错:
error while loading shared libraries: libmysqlclient.so.18 找不到此文件
类似这样的问题,根据提示在mysql安装目录中lib下软连该文件到usr/lib(64) 
注意自己是多少位的系统 放在响应目录下即可

6.ecstore系统后台安装app即显示如下

2b3d3d85-58be-495b-9b95-55559bfd7105

前台显示如图:

7a7eede1-17b3-4178-9c2b-5477f0f471b5

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注