Skip to content

Commit

Permalink
try 3.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Mar 20, 2024
1 parent 763ee9f commit a7dab7b
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
php:
- "7.2"
sphinx:
- "2.2.11"
- "3.5.1"

steps:
- name: Checkout
Expand Down
13 changes: 13 additions & 0 deletions tests/data/actions/sphinx-setup-3.5.1.sh
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
120 changes: 120 additions & 0 deletions tests/data/sphinx-3.5.1.conf
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
}

0 comments on commit a7dab7b

Please sign in to comment.