#
# Minimal Sphinx configuration sample (clean, simple, functional)
#

source base
{
   type = mysql
   sql_host = localhost
   sql_db = piler
   sql_user = piler
   sql_pass = piler
}

source main : base
{
   sql_query_pre = SET NAMES utf8
   sql_query = SELECT id, `from`, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index \
        WHERE id<=( SELECT max_doc_id FROM sph_counter WHERE counter_id=1 )

   sql_attr_uint = size
   sql_attr_uint = arrived
   sql_attr_uint = sent
   sql_attr_uint = direction
   sql_attr_uint = folder
   sql_attr_uint = attachments

}


source delta : base
{
   sql_query_pre = SET NAMES utf8
   sql_query_pre  = REPLACE INTO sph_counter SELECT 1, MAX(id) FROM sph_index
   sql_query_post_index  = DELETE FROM sph_index WHERE id<=(SELECT max_doc_id FROM sph_counter WHERE counter_id=1)
   sql_query = SELECT id, `from`, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index \
        WHERE id <= (SELECT max_doc_id FROM sph_counter WHERE counter_id=1)

   sql_attr_uint = size
   sql_attr_uint = arrived
   sql_attr_uint = sent
   sql_attr_uint = direction
   sql_attr_uint = folder
   sql_attr_uint = attachments

   sql_query_killlist = SELECT `id` FROM `metadata` WHERE `deleted`=1

}


source tag : base
{
   sql_query_pre = SET NAMES utf8
   sql_query  = SELECT `_id`, `id`, `uid`, `tag` FROM `tag`

   sql_attr_uint = id
   sql_attr_uint = uid

}


source note : base
{
   sql_query_pre = SET NAMES utf8
   sql_query  = SELECT `_id`, `id`, `uid`, `note` FROM `note`

   sql_attr_uint = id
   sql_attr_uint = uid

}


index main1
{
	source			= main
	path			= /var/piler/sphinx/main1
	docinfo			= extern
	charset_type		= utf-8
        enable_star             = 1
        min_prefix_len          = 6
        min_word_len            = 1

}


index delta1
{
        source                  = delta
        path                    = /var/piler/sphinx/delta1
        docinfo                 = extern
        charset_type            = utf-8
        enable_star             = 1
        min_prefix_len          = 6
        min_word_len            = 1

}


index tag1
{
        source                  = tag
        path                    = /var/piler/sphinx/tag1
        docinfo                 = extern
        charset_type            = utf-8
        enable_star             = 1
        min_prefix_len          = 6
        min_word_len            = 1
}


index note1
{
        source                  = note
        path                    = /var/piler/sphinx/note1
        docinfo                 = extern
        charset_type            = utf-8
        enable_star             = 1
        min_prefix_len          = 6
        min_word_len            = 1
}


indexer
{
	mem_limit		= 64M
}


searchd
{
	listen			= 127.0.0.1:9312
	listen			= 127.0.0.1:9306:mysql41
	log			= /dev/null
	binlog_path             = 
	##query_log		=
	read_timeout		= 5
	max_children		= 30
	pid_file		= /var/piler/sphinx/searchd.pid
	max_matches		= 1000
	seamless_rotate		= 1
	preopen_indexes		= 1
	unlink_old		= 1
	workers			= threads # for RT to work
	compat_sphinxql_magics  = 0
}
