-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
134 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ jobs: | |
php: | ||
- "7.2" | ||
sphinx: | ||
- "2.2.11" | ||
- "3.5.1" | ||
|
||
steps: | ||
- name: Checkout | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh -e | ||
SCRIPT=$(readlink -f "$0") | ||
CWD=$(dirname "$SCRIPT") | ||
|
||
wget https://sphinxsearch.com/files/sphinx-3.5.1-82c60cb-linux-amd64.tar.gz -O /tmp/sphinxsearch.tar.gz \ | ||
&& mkdir /opt/sphinx \ | ||
&& cd /opt/sphinx \ | ||
&& tar -zxf /tmp/sphinxsearch.tar.gz \ | ||
&& rm /tmp/sphinxsearch.tar.gz | ||
|
||
# make dir that is used in sphinx config | ||
mkdir -p sphinx | ||
sed -i s\~SPHINX_BASE_DIR~$PWD/sphinx~g $CWD/../sphinx-3.5.1.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# Sphinx configuration for the unit tests | ||
# | ||
# Setup test environment: | ||
# - initialize test database source: | ||
# mysql -D yiitest -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 = root | ||
sql_pass = root | ||
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 | ||
} | ||
|
||
|
||
source yii2_test_item_src | ||
{ | ||
type = mysql | ||
|
||
sql_host = localhost | ||
sql_user = root | ||
sql_pass = root | ||
sql_db = yiitest | ||
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 | ||
} | ||
|
||
|
||
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 | ||
docinfo = extern | ||
} | ||
|
||
|
||
index yii2_test_item_index | ||
{ | ||
source = yii2_test_item_src | ||
docinfo = extern | ||
} | ||
|
||
|
||
index yii2_test_item_delta_index : yii2_test_item_index | ||
{ | ||
source = yii2_test_item_delta_src | ||
} | ||
|
||
|
||
index yii2_test_rt_index | ||
{ | ||
type = rt | ||
rt_field = title | ||
rt_attr_string = title | ||
rt_field = content | ||
rt_attr_uint = type_id | ||
rt_attr_multi = category | ||
} | ||
|
||
|
||
index yii2_test_distributed | ||
{ | ||
type = distributed | ||
local = yii2_test_article_index | ||
} | ||
|
||
common { | ||
datadir = SPHINX_BASE_DIR | ||
} | ||
|
||
indexer | ||
{ | ||
mem_limit = 32M | ||
} | ||
|
||
searchd | ||
{ | ||
#listen = 127.0.0.1:9312 | ||
listen = 19306:mysql41 | ||
read_timeout = 5 | ||
max_children = 30 | ||
seamless_rotate = 1 | ||
preopen_indexes = 1 | ||
unlink_old = 1 | ||
workers = threads # for RT to work | ||
} |