欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

【实战】sphinx的配置文件

程序员文章站 2022-04-18 16:31:28
...

#源定义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 do

#源定义
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=$start AND id=$start AND id(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
{
}