#
# sphinx configuration file for CATS
#

#############################################################################
## data source definition
#############################################################################

source catsdb
{
	type			= mysql
	strip_html		= 0
	index_html_attrs	=

	# some straightforward parameters for 'mysql' source type
	sql_host			= localhost
	sql_user			= cats
	sql_pass			= password
	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_group_column	= site_id
	sql_date_column		= date_added
	sql_query_post		=
	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 definition
#############################################################################

index cats
{
	source			= catsdb

	# this is path and index file name without extension
	#
	# indexer will append different extensions to this path to
	# generate names for both permanent and temporary index files
	#
	# .tmp* files are temporary and can be safely removed
	# if indexer fails to remove them automatically
	#
	# .sp* files are fulltext index data files. specifically,
	# .spa contains attribute values attached to each document id
	# .spd contains doclists and hitlists
	# .sph contains index header (schema and other settings)
	# .spi contains wordlists
	#
	# MUST be defined
	path		= /home/will/public_html/cats-sphinx/lib/sphinx/index/cats

	docinfo		= extern
	morphology	= none
	stopwords	= /home/will/public_html/cats-sphinx/lib/sphinx/STOPWORDS
	min_word_len	= 1
	charset_type	= utf-8
}

index catsdelta : cats
{
    source          	= delta
    path            	= /home/will/public_html/cats-sphinx/lib/sphinx/index/cats_delta

}

#############################################################################
## indexer settings
#############################################################################

indexer
{
	mem_limit			= 128M
}

#############################################################################
## searchd settings
#############################################################################

searchd
{

	address = 127.0.0.1
	port			= 3312
	log			= /home/will/public_html/cats-sphinx/lib/sphinx/var/log/searchd.log
	query_log		= /home/will/public_html/cats-sphinx/lib/sphinx/var/log/query.log
	read_timeout		= 5
	max_children		= 30
	pid_file		= /home/will/public_html/cats-sphinx/lib/sphinx/var/run/searchd.pid
	# default is 1000 (just like with Google)
	max_matches		= 1000
}
