sphinx.conf 2.49 KB
Newer Older
1
# Sphinx configuration for the unit tests
2
#
3 4
# Setup test environment:
# - initialize test database source:
5
# mysql -D yiitest -u test < /path/to/yii/tests/unit/data/sphinx/source.sql
6 7 8 9 10
# - setup test Sphinx indexes:
# indexer --config /path/to/yii/tests/unit/data/sphinx/sphinx.conf --all [--rotate]
# - run the "searchd" daemon:
# searchd --config /path/to/yii/tests/unit/data/sphinx/sphinx.conf

11 12 13 14 15 16

source yii2_test_article_src
{
	type			= mysql

	sql_host		= localhost
17
	sql_user		= travis
18
	sql_pass		=
19
	sql_db			= yiitest
20 21 22 23 24 25 26
	sql_port		= 3306	# optional, default is 3306

	sql_query		= \
		SELECT *, UNIX_TIMESTAMP(create_date) AS add_date \
		FROM yii2_test_article

	sql_attr_uint		= id
27
	sql_attr_uint		= author_id
28
	sql_attr_timestamp	= add_date
29
	sql_attr_multi		= uint tag from query; SELECT article_id AS id, tag_id AS tag FROM yii2_test_article_tag
30 31 32 33 34 35 36 37 38 39

	sql_query_info		= SELECT * FROM yii2_test_article WHERE id=$id
}


source yii2_test_item_src
{
	type			= mysql

	sql_host		= localhost
40
	sql_user		= travis
41
	sql_pass		=
42
	sql_db			= yiitest
43 44 45 46
	sql_port		= 3306	# optional, default is 3306

	sql_query		= \
		SELECT *, CURRENT_TIMESTAMP() AS add_date \
47 48
		FROM yii2_test_item \
		WHERE id <= 100
49 50

	sql_attr_uint		= id
51 52
	sql_attr_uint		= category_id
	sql_attr_float		= price
53 54 55 56 57 58
	sql_attr_timestamp	= add_date

	sql_query_info		= SELECT * FROM yii2_test_item WHERE id=$id
}


59 60 61 62 63 64 65 66 67
source yii2_test_item_delta_src : yii2_test_item_src
{
	sql_query		= \
		SELECT *, CURRENT_TIMESTAMP() AS add_date \
		FROM yii2_test_item \
		WHERE id > 100
}


68 69 70
index yii2_test_article_index
{
	source			= yii2_test_article_src
71
	path			= /var/lib/sphinx/yii2_test_article
72 73 74 75 76 77 78 79
	docinfo			= extern
	charset_type	= sbcs
}


index yii2_test_item_index
{
	source			= yii2_test_item_src
80
	path			= /var/lib/sphinx/yii2_test_item
81 82 83 84 85
	docinfo			= extern
	charset_type	= sbcs
}


86 87 88 89 90 91 92
index yii2_test_item_delta_index : yii2_test_item_index
{
	source			= yii2_test_item_delta_src
	path			= /var/lib/sphinx/yii2_test_item_delta
}


93 94 95 96 97 98 99
index yii2_test_rt_index
{
	type			= rt
	path			= /var/lib/sphinx/yii2_test_rt
	rt_field		= title
	rt_field		= content
	rt_attr_uint	= type_id
100
	rt_attr_multi	= category
101 102 103
}


104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
indexer
{
	mem_limit		= 32M
}


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