Skip to content

Commit 2f30dde

Browse files
authored
Merge pull request magento#3614 from magento-tango/MAGETWO-97495
[TANGO] PR
2 parents d1ebc17 + a3f2cde commit 2f30dde

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

app/code/Magento/Elasticsearch/SearchAdapter/Dynamic/DataProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ public function getAggregation(
212212
'histogram' => [
213213
'field' => $fieldName,
214214
'interval' => (float)$range,
215+
'min_doc_count' => 1,
215216
],
216217
],
217218
];

app/code/Magento/Elasticsearch/Test/Unit/SearchAdapter/Dynamic/DataProviderTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,15 @@ public function testGetAggregation()
321321
$this->clientMock->expects($this->once())
322322
->method('query')
323323
->with($this->callback(function ($query) {
324+
$histogramParams = $query['body']['aggregations']['prices']['histogram'];
324325
// Assert the interval is queried as a float. See MAGETWO-95471
325-
return $query['body']['aggregations']['prices']['histogram']['interval'] === 10.0;
326+
if ($histogramParams['interval'] !== 10.0) {
327+
return false;
328+
}
329+
if (!isset($histogramParams['min_doc_count']) || $histogramParams['min_doc_count'] !== 1) {
330+
return false;
331+
}
332+
return true;
326333
}))
327334
->willReturn([
328335
'aggregations' => [

0 commit comments

Comments
 (0)