码迷,mamicode.com
首页 > 其他好文 > 详细

【实战】sphinx的配置文件

时间:2014-12-02 15:18:56      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:sphinx 2.2.6配置文件

#源定义
source src1
{
        type                    = mysql
        sql_host                = localhost
        sql_user                = root
        sql_pass                =password
        sql_db                  = test
        sql_sock                = /usr/local/mysql/mysql.sock
        sql_query_pre           = SET NAMES utf8
        sql_query_pre           = REPLACE INTO sph_counter SELECT 1, MAX(id) FROM documents
        sql_query               =                 SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content                 FROM documents where id<=(SELECT max_doc_id FROM sph_counter WHERE counter_id=1)
        sql_attr_uint           = group_id
        sql_attr_timestamp      = date_added
        sql_ranged_throttle     = 0
}



#######源
#tblpnr
source src2
{
        type                    = mysql
        sql_host                = localhost
        sql_user                = root
        sql_pass                =password
        sql_db                  = jinripnr
        sql_sock                = /usr/local/mysql/mysql.sock
        sql_query_pre           = SET NAMES utf8
				sql_query_pre         	= REPLACE INTO jinri.sph_counter SELECT 2, MAX(id),max(update_time) FROM tblpnr
        sql_query               =                 SELECT id,orderno,pnr,ordertime FROM tblpnr where 		update_time<=(SELECT last_time FROM jinri.sph_counter WHERE counter_id=2) 
        #字符串属性设置、需要过滤、排序的时候用到
	#sql_attr_uint           = 
        sql_attr_timestamp      = ordertime
	sql_attr_string		= orderno  #只检索orderno
	sql_field_string 	= pnr  
	#sql_field_string 用于全文即保存索引,sql_attr_string只用于检索即不保存索引
	
	#分区查询设置
	#sql_query_range = SELECT MIN(id),MAX(id) FROM tblpnr
	#sql_range_step = 500000
	#sql_query = SELECT * FROM tblpnr WHERE id>=$start AND id<=$end
  sql_ranged_throttle     = 0  #无时间间隔,单位是秒
}




#tblticketno
source src3
{
        type                    = mysql
        sql_host                = localhost
        sql_user                = root
        sql_pass                =password
        sql_db                  = jinritickno
        sql_sock                = /usr/local/mysql/mysql.sock
        sql_query_pre           = SET NAMES utf8
				sql_query_pre         	= REPLACE INTO jinri.sph_counter SELECT 3, MAX(id), 				max(update_time) FROM tblticketno
        sql_query               =                 SELECT id,orderno, ticketno,ordertime                 FROM tblticketno where update_time<=(SELECT last_time FROM jinri.sph_counter 		WHERE counter_id=3)
        #字符串属性设置、需要过滤、排序的时候用到
	#sql_attr_uint           = 
        sql_attr_timestamp      = ordertime
	sql_attr_string		= orderno  #只检索orderno
	sql_field_string	= ticketno 
	#sql_field_string 用于全文即保存索引,sql_attr_string只用于检索即不保存索引
  #分区查询设置
	#sql_query_range = SELECT MIN(id),MAX(id) FROM tblticketno
	#sql_range_step = 1000000
	#sql_query = SELECT * FROM tblticketno WHERE id>=$start AND id<=$end
  sql_ranged_throttle     = 0
}



#tblpassengername
source src4
{
        type                    = mysql
        sql_host                = localhost
        sql_user                = root
        sql_pass                =password
        sql_db                  = jinripname
        sql_sock                = /usr/local/mysql/mysql.sock
        sql_query_pre           = SET NAMES utf8
	sql_query_pre         	= REPLACE INTO jinri.sph_counter SELECT 4, MAX(id), 				max(update_time) FROM tblpassengername
        sql_query               =                 SELECT id,orderno, passengername,ordertime                 FROM tblpassengername where update_time<=(SELECT last_time FROM jinri.sph_counter 		WHERE counter_id=4)
        #字符串属性设置、需要过滤、排序的时候用到
	#sql_attr_uint           = 
        sql_attr_timestamp      = ordertime
	sql_attr_string		= orderno  #只检索orderno
	sql_field_string	= passengername 
	#sql_field_string 用于全文即保存索引,sql_attr_string只用于检索即不保存索引
        sql_ranged_throttle     = 0
}



#tblorderno
source src5
{
        type                    = mysql
        sql_host                = localhost
        sql_user                = root
        sql_pass                =password
        sql_db                  = jinriorderno
        sql_sock                = /usr/local/mysql/mysql.sock
        sql_query_pre           = SET NAMES utf8
        sql_query_pre           = REPLACE INTO jinri.sph_counter SELECT 5, MAX(id),                                 max(update_time) FROM tblorderno
        sql_query               =                 SELECT id,orderno,ordertime                 FROM tblorderno where update_time<=(SELECT last_time FROM jinri.sph_counter                 WHERE counter_id=5)
        #字符串属性设置、需要过滤、排序的时候用到
        #sql_attr_uint           =
        sql_attr_timestamp      = ordertime
        sql_field_string        = orderno
        #sql_field_string 用于全文即保存索引,sql_attr_string只用于检索即不保存索引
        sql_ranged_throttle     = 0
}


#tblpnr
source src2throttled : src2
{
	sql_ranged_throttle	= 100
}

#tblticketno
source src3throttled : src3
{
	sql_ranged_throttle	= 100
}

#tblpassengername
source src4throttled : src4
{
	sql_ranged_throttle	= 100
}

#tblorderno
source src5throttled : src5
{
	sql_ranged_throttle	= 100
}


########增量源
#tblpnr
source src2_delta:src2
{
        sql_query_pre           = SET NAMES utf8
	sql_query_pre         	= 
        sql_query               =                SELECT id,orderno, pnr,ordertime                FROM tblpnr where update_time>(SELECT last_time 	       FROM jinri.sph_counter WHERE counter_id=2)
}


#tblticketno
source src3_delta:src3
{
        sql_query_pre           = SET NAMES utf8
	sql_query_pre         	= 
        sql_query               =                SELECT id,orderno, ticketno,ordertime                FROM tblticketno where update_time>(SELECT last_time  	       FROM jinri.sph_counter WHERE counter_id=3)
}


#tblpassengername
source src4_delta:src4
{
        sql_query_pre           = SET NAMES utf8
	sql_query_pre         	= 
        sql_query               =                SELECT id,orderno,passengername,ordertime                FROM tblpassengername where update_time>(SELECT last_time  	       FROM jinri.sph_counter WHERE counter_id=4)
}


#tblorderno
source src5_delta:src5
{
        sql_query_pre           = SET NAMES utf8
        sql_query_pre           =
        sql_query               =                SELECT id,orderno,ordertime                FROM tblorderno where update_time>(SELECT last_time                 FROM jinri.sph_counter WHERE counter_id=5)
}


######索引
#tblpnr
index src2
{
        source                  = src2
        path                    = /usr/local/sphinx/var/data/src2
        docinfo                 = extern
        dict                    = keywords
        mlock                   = 0
        morphology              = none
        min_word_len            = 1
        html_strip              = 0
        min_prefix_len = 0 #最小前缀
        min_infix_len = 0 #最小中缀
        ngram_len = 1 # 对于非字母型数据的长度切割,支持中文需要设置为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
}

#tblticketno
index src3
{
        source                  = src3
        path                    = /usr/local/sphinx/var/data/src3
        docinfo                 = extern
        dict                    = keywords
        mlock                   = 0
        morphology              = none
        min_word_len            = 1
        html_strip              = 0
        min_prefix_len = 0 #最小前缀
        min_infix_len = 0 #最小中缀
        ngram_len = 1 # 对于非字母型数据的长度切割,支持中文需要设置为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
}


#tblpassengername
index src4
{
        source                  = src4
        path                    = /usr/local/sphinx/var/data/src4
        docinfo                 = extern
        dict                    = keywords
        mlock                   = 0
        morphology              = none
        min_word_len            = 1
        html_strip              = 0
        min_prefix_len = 0 #最小前缀
        min_infix_len = 0 #最小中缀
        ngram_len = 1 # 对于非字母型数据的长度切割,支持中文需要设置为1
        ngram_chars = U+3000..U+2FA1F,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
}


#tblorderno
index src5
{
        source                  = src5
        path                    = /usr/local/sphinx/var/data/src5
        docinfo                 = extern
        dict                    = keywords
        mlock                   = 0
        morphology              = none
        min_word_len            = 1
        html_strip              = 0
        min_prefix_len = 0 #最小前缀
        min_infix_len = 1 #最小中缀,支持模糊查询
        ngram_len = 1 # 对于非字母型数据的长度切割,支持中文需要设置为1
        ngram_chars = U+3000..U+2FA1F,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
}



######增量索引
#tblprn
index src2_delta
{
        source                  = src2_delta
        path                    = /usr/local/sphinx/var/data/src2_delta
        docinfo                 = extern
        dict                    = keywords
        mlock                   = 0
        morphology              = none
        min_word_len            = 1
        html_strip              = 0
        min_prefix_len = 0 #最小前缀
        min_infix_len = 0 #最小中缀
        ngram_len = 1 # 对于非字母型数据的长度切割,支持中文需要设置为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
}

#tblticketno
index src3_delta
{
        source                  = src3_delta
        path                    = /usr/local/sphinx/var/data/src3_delta
        docinfo                 = extern
        dict                    = keywords
        mlock                   = 0
        morphology              = none
        min_word_len            = 1
        html_strip              = 0
        min_prefix_len = 0 #最小前缀
        min_infix_len = 0 #最小中缀
        ngram_len = 1 # 对于非字母型数据的长度切割,支持中文需要设置为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
}

#tblpassengername

index src4_delta
{
        source                  = src4_delta
        path                    = /usr/local/sphinx/var/data/src4_delta
        docinfo                 = extern
        dict                    = keywords
        mlock                   = 0
        morphology              = none
        min_word_len            = 1
        html_strip              = 0
        min_prefix_len = 0 #最小前缀
        min_infix_len = 0 #最小中缀
        ngram_len = 1 # 对于非字母型数据的长度切割,支持中文需要设置为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
}


#tblorderno
index src5_delta
{
        source                  = src5_delta
        path                    = /usr/local/sphinx/var/data/src5_delta
        docinfo                 = extern
        dict                    = keywords
        mlock                   = 0
        morphology              = none
        min_word_len            = 1
        html_strip              = 0
        min_prefix_len = 0 #最小前缀
        min_infix_len = 1 #最小中缀,支持模糊查询
        ngram_len = 1 # 对于非字母型数据的长度切割,支持中文需要设置为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
}


#########inherited index :索引继承 
#tblpnr
#index src2stemmed : src2
#{
#	path			= /usr/local/sphinx/var/data/src2stemmed
#	morphology		= stem_en
#}

#tblticketno
#index src3stemmed : src3
#{
#	path			= /usr/local/sphinx/var/data/src3stemmed
#	morphology		= stem_en
#}


#tblpassengername
#index src4stemmed : src4
#{
#	path			= /usr/local/sphinx/var/data/src4stemmed
#	morphology		= stem_en
#}

#########分布式搜索
#tblpnr
index dist2
{
        type                    = distributed
        local                   = src2
        local                   = src2_delta
}


#tblticketno
index dist3
{
        type                    = distributed
        local                   = src3
        local                   = src3_delta
}

#tblpassengername
index dist4
{
        type                    = distributed
        local                   = src4
        local                   = src4_delta
}


#orderno:intpu value include *,not support dist query
#index dist5
#{
#        type                    = distributed
#        local                   = src5
#        local                   = src5_delta
#}


index rt
{
        type                    = rt
        path                    = /usr/local/sphinx/var/data/rt
        rt_field                = title
        rt_field                = content
        rt_attr_uint            = gid
}

indexer
{
        mem_limit               = 1024M
}

searchd
{
#        listen                  = /var/run/searchd.sock
        listen                  = 127.0.0.1:9312:sphinx
        listen                  = 9306:mysql41
        listen                  = 192.168.0.128:9312:sphinx
        log                     = /usr/local/sphinx/var/log/searchd.log
        query_log               = /usr/local/sphinx/var/log/query.log
        read_timeout            = 5
        client_timeout          = 300
        max_children            = 30
        persistent_connections_limit    = 30
        pid_file                = /usr/local/sphinx/var/log/searchd.pid
        seamless_rotate         = 1 ### 是否支持无缝切换,做增量索引时通常需要
        preopen_indexes         = 1
        unlink_old              = 1
        mva_updates_pool        = 1M
        max_packet_size         = 8M
        max_filters             = 256
        max_filter_values       = 4096
        max_batch_queries       = 32
        dist_threads            = 2

}
common
{
}

【实战】sphinx的配置文件

标签:sphinx 2.2.6配置文件

原文地址:http://blog.csdn.net/yangzhawen/article/details/41678055

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!