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

source catsdb
{
	type			= mysql

	sql_host		= localhost
	sql_user		= cats
	sql_pass		= yourpasshere
	sql_db			= cats
	sql_port		= 3306	# optional, default is 3306
    
        sql_query_pre       	= \
		REPLACE INTO sph_counter SELECT 1, MAX(attachment_id) from attachment

	sql_query		= \
		SELECT attachment_id, title, attachment.site_id AS site_id, UNIX_TIMESTAMP(attachment.date_created) AS date_added, text \
        FROM attachment LEFT JOIN candidate ON data_item_id = candidate_id \
        WHERE resume = 1 AND data_item_type IN(100,500) AND text IS NOT NULL AND text != '' \
        AND attachment_id <= (SELECT max_doc_id FROM sph_counter WHERE counter_id = 1)

	sql_attr_uint		= site_id
	sql_attr_timestamp	= date_added

	sql_query_info		= SELECT * FROM attachment WHERE attachment_id=$id
}

source delta : catsdb 
{
	sql_query_pre =
	sql_query = \
        	SELECT attachment_id, title, attachment.site_id AS site_id, UNIX_TIMESTAMP(attachment.date_created) AS date_added, text \
        FROM attachment LEFT JOIN candidate ON data_item_id = candidate_id \
        WHERE resume = 1 AND data_item_type IN(100,500) AND text IS NOT NULL AND text != '' \
        AND attachment_id > (SELECT max_doc_id FROM sph_counter WHERE counter_id = 1)
}

index cats
{
	source			= catsdb
	path			= /opt/var/data/catsindex
	docinfo			= extern
	min_word_len    	= 1
	charset_type		= utf-8
}

index catsdelta : cats
{
	source 			= delta
	path			= /opt/var/data/catsdelta
}

indexer
{
	mem_limit		= 32M
}


searchd
{
	listen			= 9312
	listen			= 9306:mysql41
	log			= /opt/var/log/searchd.log
	query_log		= /opt/var/log/query.log
	read_timeout		= 5
	max_children		= 30
	pid_file		= /opt/var/log/searchd.pid
	max_matches		= 1000
	seamless_rotate		= 1
	preopen_indexes		= 1
	unlink_old		= 1
	workers			= threads # for RT to work
	binlog_path		= /opt/var/data
}
