source torrentpier
{
	type                    = mysql
	sql_host                = localhost
	sql_user                = user
	sql_pass                = pass
	sql_db                  = dbase
	sql_query_pre           = SET NAMES utf8
	sql_query_pre           = SET CHARACTER_SET_RESULTS=utf8
	sql_query_pre           = SET CHARACTER_SET_CLIENT=utf8
}

source topics: torrentpier
{
	sql_query               = \
		SELECT topic_id, forum_id, topic_title \
		FROM bb_topics \
		WHERE topic_id BETWEEN $start AND $end

	sql_query_range         = SELECT MIN(topic_id), MAX(topic_id) FROM bb_topics
	sql_range_step          = 100000

	sql_attr_uint           = forum_id
	sql_ranged_throttle     = 50
	sql_query_info          = SELECT * FROM bb_topics WHERE topic_id = $id
}

source posts: torrentpier
{
	sql_query               = \
		SELECT pt.post_id, pt.post_text, t.topic_title, t.topic_id, t.forum_id \
		FROM bb_posts_text pt \
			LEFT JOIN bb_topics t on pt.post_id = t.topic_first_post_id \
		WHERE pt.post_id BETWEEN $start AND $end

    sql_query_range         = SELECT MIN(post_id), MAX(post_id) FROM bb_posts_text
    sql_range_step          = 100000

	sql_attr_uint           = topic_id
	sql_attr_uint           = forum_id
	sql_ranged_throttle     = 50
	sql_query_info          = SELECT * FROM bb_posts_text WHERE post_id = $id
}

source users: torrentpier
{
	sql_query               = \
		SELECT user_id, username \
		FROM bb_users \
		WHERE user_id BETWEEN $start AND $end

	sql_query_range         = SELECT 1, MAX(user_id) FROM bb_users
	sql_range_step          = 1000
	sql_query_info          = SELECT * FROM bb_users WHERE user_id = $id
}

index topics
{
	docinfo                 = extern
	morphology              = stem_enru
	charset_type            = utf-8
	charset_table           = 0..9, A..Z->a..z, _, a..z, U+410..U+42C->U+430..U+44C, U+42E..U+42F->U+44E..U+44F, U+430..U+44C, U+44E..U+44F, U+0401->U+0435, U+0451->U+0435, U+042D->U+0435, U+044D->U+0435
	min_prefix_len          = 0
	min_infix_len           = 0
	min_word_len            = 1
	min_stemming_len     	= 4
	enable_star             = 1
	phrase_boundary         = :, - , . , $
	phrase_boundary_step    = 1
	html_strip              = 1
	path                    = ./sphinx/data/topics
	source                  = topics
}

index posts: topics
{
	path                    = ./sphinx/data/posts
	source                  = posts
}

index users: topics
{
	path                    = ./sphinx/data/users
	source                  = users
}

indexer
{
	mem_limit               = 256M
}

searchd
{
	listen                  = 127.0.0.1:3312
	log                     = ./sphinx/log/searchd.log
	query_log               = ./sphinx/log/query.log
	read_timeout            = 5
	max_children            = 15
	max_matches             = 5000
	seamless_rotate  		= 1
	preopen_indexes         = 0
	unlink_old              = 1
	pid_file                = ./sphinx/searchd.pid
}