#
# Minimal Sphinx configuration sample (clean, simple, functional)
# source mysql
{
type = mysql #数据库类型 #新服务器
sql_host = 192.168.0.0
sql_user = root
sql_pass = test
sql_db = test
sql_port = 3306 sql_query_pre = SET NAMES utf8
sql_query_pre = SET SESSION query_cache_type=OFF
} ########## 数据源统一放在一起 ##########
source indexLocation:mysql{
sql_query = SELECT a.location_id as id,a.location_id,a.location_name as `location_name`,a.location_name as `name`,a.location_bname,a.attach_id,a.showstatus,a.is_del,a.status,b.area_name as city_name FROM `ts_rdd_location` a LEFT JOIN `ts_rdd_area` b ON a.city_id = b.area_id
#sql_attr_string = name
sql_attr_uint = status
#sql_attr_timestamp = date_added
sql_query_info = SELECT * FROM `ts_rdd_location` WHERE location_id = $id } source indexNearby:mysql{
sql_query = SELECT a.product_id as id,a.product_id,a.product_name as `name`,a.product_name,a.num,a.num_sale,a.img,b.area_name as city_name FROM `ts_rdd_nearby_product` a LEFT JOIN `ts_rdd_area` b ON a.city_id = b.area_id
#sql_attr_string = name
#sql_attr_uint = status
#sql_attr_timestamp = date_added
sql_query_info = SELECT * FROM `ts_rdd_nearby_product` WHERE product_id = $id
} ########## 索引定义统一放在一起 ##########
index indexLocation
{
source = indexLocation #声明索引源
path = /usr/local/var/data/indexLocation #索引文件存放路径及索引的文件名。不要和其它索引名重名。
docinfo = extern #文档信息存储方式
mlock = 0 #缓存数据内存锁定
morphology = none #形态学(对中文无效)
min_word_len = 2 #索引的词最小长度
charset_type = utf-8
min_prefix_len = 0 #最小前缀
html_strip = 1
ngram_len = 1 #对于非字母型数据的长度切割
ngram_chars = U+3000..U+2FA1F #则会对每个中文,英文字词进行分割,速度会慢 #字符表,注意:如使用这种方式,则sphinx会对中文进行单字切分,即进行字索引。
#若要使用中文分词,必须使用其他分词插件如 coreseek,sfc
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
} index indexNearby
{
source = indexNearby #声明索引源
path = /usr/local/var/data/indexNearby #索引文件存放路径及索引的文件名。不要和其它索引名重名。
docinfo = extern #文档信息存储方式
mlock = 0 #缓存数据内存锁定
morphology = none #形态学(对中文无效)
min_word_len = 2 #索引的词最小长度
charset_type = utf-8
min_prefix_len = 0 #最小前缀
html_strip = 1
ngram_len = 1 #对于非字母型数据的长度切割
ngram_chars = U+3000..U+2FA1F #则会对每个中文,英文字词进行分割,速度会慢 #字符表,注意:如使用这种方式,则sphinx会对中文进行单字切分,即进行字索引。
#若要使用中文分词,必须使用其他分词插件如 coreseek,sfc
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
} ########## 索引器配置 ##########
indexer
{
mem_limit = 128M #内存限制
} ########## 索引器配置 ##########
searchd
{
listen = 9312 #监听端口,官方已在IANA获得正式授权的9312端口。以前版本默认的是3312。
log = /usr/local/sphinx/var/log/searchd.log #服务进程日志 ,一旦sphinx出现异常,基本上可以从这里查询有效信息
query_log = /usr/local/sphinx/var/log/query.log #客户端查询日志,笔者注:若欲对一些关键词进行统计,可以分析此日志文件
read_timeout = 5 #请求超时
max_children = 30 #同时可执行的最大searchd 进程数
pid_file = /usr/local/sphinx/var/searchd.pid #进程ID文
max_matches = 10000 # 查询结果的最大返回数
seamless_rotate = 1 # 是否支持无缝切换,做增量索引时通常需要
workers = threads # for RT to workbinlog_path
preopen_indexes = 1
unlink_old = 1
compat_sphinxql_magics = 0
}
05-11 14:03