Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Stenvall committed Nov 2, 2017
2 parents 5288a54 + 07bb6c8 commit 49ed2d0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [2.2.1] - 2017-11-02
### Fixed
- Fixed an issue with empty match_all queries

## [2.2.0] - 2017-11-01
### Added
- Support for terms aggregation
Expand Down
2 changes: 1 addition & 1 deletion src/Search/Search.php
Expand Up @@ -244,7 +244,7 @@ public function buildBody()
}
}
if (empty($body['query'])) {
$body['query'] = ['match_all' => []];
$body['query'] = ['match_all' => new \stdClass()];
}

if (($sort = $this->getSort())) {
Expand Down
12 changes: 6 additions & 6 deletions tests/Search/SearchTest.php
Expand Up @@ -100,7 +100,7 @@ public function testToArray()
$this->search->setSize(100);

$this->assertEquals([
'query' => ['match_all' => []],
'query' => ['match_all' => new \stdClass()],
'size' => 100,
'from' => 0,
], $this->search->buildBody());
Expand All @@ -110,7 +110,7 @@ public function testToArray()
$this->search->setSize(100);

$this->assertEquals([
'query' => ['match_all' => []],
'query' => ['match_all' => new \stdClass()],
'size' => 100,
'from' => 100,
], $this->search->buildBody());
Expand All @@ -120,7 +120,7 @@ public function testToArray()
$this->search->setSize(10);

$this->assertEquals([
'query' => ['match_all' => []],
'query' => ['match_all' => new \stdClass()],
'from' => 10,
'size' => 10,
], $this->search->buildBody());
Expand Down Expand Up @@ -148,7 +148,7 @@ public function testToArray()
$this->search->setSort($this->sort);

$this->assertEquals([
'query' => ['match_all' => []],
'query' => ['match_all' => new \stdClass()],
'sort' => ['_score'],
'size' => 100,
'from' => 0,
Expand All @@ -158,7 +158,7 @@ public function testToArray()
$this->search->addAggregation($this->aggregation);

$this->assertEquals([
'query' => ['match_all' => []],
'query' => ['match_all' => new \stdClass()],
'aggs' => [
'global_name' => [
'global' => new \stdClass(),
Expand Down Expand Up @@ -192,7 +192,7 @@ public function testAddAggregations()
$this->assertInstanceOf(AggregationCollection::class, $this->search->getAggregations());

$this->assertEquals([
'query' => ['match_all' => []],
'query' => ['match_all' => new \stdClass()],
'aggs' => [
'name1' => [
'terms' => [
Expand Down

0 comments on commit 49ed2d0

Please sign in to comment.