From 8472f5098d40280d272afb680714a26a32d2ea5c Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Wed, 20 Mar 2024 13:12:19 +0300 Subject: [PATCH] fix --- tests/QueryTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/QueryTest.php b/tests/QueryTest.php index 79ed0e7b..67cc3a08 100644 --- a/tests/QueryTest.php +++ b/tests/QueryTest.php @@ -458,8 +458,6 @@ public function testFacets() { $connection = $this->getConnection(); - $sphinxVersion = $connection->createCommand("SHOW GLOBAL VARIABLES LIKE 'version'")->queryOne()['Value']; -var_dump($sphinxVersion); $query = new Query(); $results = $query->from('yii2_test_article_index') ->match('about') @@ -486,22 +484,24 @@ public function testFacets() ->from('yii2_test_article_index') ->match('about'); - if (strpos($sphinxVersion, '2.') === 0) { + try { + // Sphinx ^3 $query = $query + ->select(new Expression('INTERVAL(author_id,200,400,600,800) AS range')) ->facets([ 'range' => [ - 'select' => 'INTERVAL(author_id,200,400,600,800) AS range', + 'select' => 'range', ], 'authorId' => [ 'select' => [new Expression('author_id AS authorId')], ], ]); - } else { + } catch (\PDOException $e) { + // Sphinx ^2 $query = $query - ->select(new Expression('INTERVAL(author_id,200,400,600,800) AS range')) ->facets([ 'range' => [ - 'select' => 'range', + 'select' => 'INTERVAL(author_id,200,400,600,800) AS range', ], 'authorId' => [ 'select' => [new Expression('author_id AS authorId')],