Sphinx配置文件设置

其实是添加中文分词后进行中文搜索coreseek中的sphinx.conf文件配置

source src2
{

type = mysql

sql_host = 127.0.0.1    // 数据库地址
 sql_user = admin                    //用户名
 sql_pass = admin        //密码
 sql_db = mydb
 sql_port = 3306 # optional, default is 3306

sql_sock = /tmp/mysql.sock    //数据库在linux服务器需开启

sql_query_pre = SET NAMES utf8         //字符编码
 sql_query_pre = SET SESSION query_cache_type=OFF

sql_query = \
 SELECT id, gid, addtime AS date_added, realname \
 FROM order_admin

sql_attr_uint = gid

sql_attr_timestamp = date_added

sql_ranged_throttle = 0

sql_query_info = SELECT * FROM order_admin WHERE id=$id

}

source src2throttled : src2    //为增量索引设置
{
 sql_ranged_throttle = 100
 sql_query = \
 SELECT id, gid, addtime AS date_added, realname \
 FROM order_admin

}

index test2
{

source = src2
 path = /usr/local/webserver/coreseek/var/data/test2

docinfo = extern

mlock = 0

morphology = none

min_word_len = 1
 charset_type = zh_cn.utf-8
 charset_dictpath =/usr/local/mmseg/etc/

# 'utf-8' default value is
 # charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F

html_strip = 0
}

//indexer 和searchd 可以默认 如果有需要监听的数据库ip可以在searchd设置

 

index test2stemmed : test2  //增量索引设置
{
 source = src2throttled
 path = /usr/local/webserver/coreseek/var/data/test2stemmed
 morphology = stem_en
}
 每次修改完配置文件,如需生效必须重新生成索引

/usr/local/webserver/coreseek/bin/indexer –rotate –config /usr/local/webserver/coreseek/etc/sphinx.conf –all 在不停止sphinx服务情况下

更新增量索引

/usr/local/webserver/coreseek/bin/indexer –rotate –config /usr/local/webserver/coreseek/etc/sphinx.conf test2stemmed

使用时使用增量索引来搜索,增量索引需要计划任务执行(数据有变化以后需更新索引才可以)

你可能感兴趣的:(sphinx配置,sphinx配置文件)