Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik committed Mar 20, 2024
1 parent 9884aaa commit 8472f50
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')],
Expand Down

0 comments on commit 8472f50

Please sign in to comment.