|
|
|
# Sphinx configuration for the unit tests
|
|
|
|
#
|
|
|
|
# Setup test environment:
|
|
|
|
# - initialize test database source:
|
|
|
|
# mysql -D yii2test -u test < /path/to/yii/tests/unit/data/sphinx/source.sql
|
|
|
|
# - 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
|
|
|
|
|
|
|
|
|
|
|
|
source yii2_test_article_src
|
|
|
|
{
|
|
|
|
type = mysql
|
|
|
|
|
|
|
|
sql_host = localhost
|
|
|
|
sql_user = travis
|
|
|
|
sql_pass =
|
|
|
|
sql_db = yiitest
|
|
|
|
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
|
|
|
|
sql_attr_uint = author_id
|
|
|
|
sql_attr_timestamp = add_date
|
|
|
|
sql_attr_multi = uint tag from query; SELECT article_id AS id, tag_id AS tag FROM yii2_test_article_tag
|
|
|
|
|
|
|
|
sql_query_info = SELECT * FROM yii2_test_article WHERE id=$id
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
source yii2_test_item_src
|
|
|
|
{
|
|
|
|
type = mysql
|
|
|
|
|
|
|
|
sql_host = localhost
|
|
|
|
sql_user = travis
|
|
|
|
sql_pass =
|
|
|
|
sql_db = yii2test
|
|
|
|
sql_port = 3306 # optional, default is 3306
|
|
|
|
|
|
|
|
sql_query = \
|
|
|
|
SELECT *, CURRENT_TIMESTAMP() AS add_date \
|
|
|
|
FROM yii2_test_item \
|
|
|
|
WHERE id <= 100
|
|
|
|
|
|
|
|
sql_attr_uint = id
|
|
|
|
sql_attr_uint = category_id
|
|
|
|
sql_attr_float = price
|
|
|
|
sql_attr_timestamp = add_date
|
|
|
|
|
|
|
|
sql_query_info = SELECT * FROM yii2_test_item WHERE id=$id
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
index yii2_test_article_index
|
|
|
|
{
|
|
|
|
source = yii2_test_article_src
|
|
|
|
path = /var/lib/sphinx/yii2_test_article
|
|
|
|
docinfo = extern
|
|
|
|
charset_type = sbcs
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
index yii2_test_item_index
|
|
|
|
{
|
|
|
|
source = yii2_test_item_src
|
|
|
|
path = /var/lib/sphinx/yii2_test_item
|
|
|
|
docinfo = extern
|
|
|
|
charset_type = sbcs
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
index yii2_test_item_delta_index : yii2_test_item_index
|
|
|
|
{
|
|
|
|
source = yii2_test_item_delta_src
|
|
|
|
path = /var/lib/sphinx/yii2_test_item_delta
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
rt_attr_multi = category
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|