Skip to content

Commit 9b023dc

Browse files
committed
Merge branch '5.x' into 6.x
# Conflicts: # composer.json
2 parents e432103 + 093bf04 commit 9b023dc

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

docs/Query/Compound/FunctionScore.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ $queryArray = $search->toArray();
105105
```php
106106
$functionScoreQuery = new FunctionScoreQuery(new MatchAllQuery());
107107
$existsQuery = new ExistsQuery('price');
108-
$functionScoreQuery->addFieldValueFactorFunction('price', 0.5, 'ln', $existsQuery);
108+
$functionScoreQuery->addFieldValueFactorFunction('price', 0.5, 'ln', $existsQuery, 0);
109109

110110
$search = new Search();
111111
$search->addQuery($functionScoreQuery);

src/Query/Compound/FunctionScoreQuery.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,21 @@ public function getQuery()
6060
* @param float $factor
6161
* @param string $modifier
6262
* @param BuilderInterface $query
63-
*
63+
* @param mixed $missing
6464
* @return $this
6565
*/
66-
public function addFieldValueFactorFunction($field, $factor, $modifier = 'none', BuilderInterface $query = null)
66+
public function addFieldValueFactorFunction($field, $factor, $modifier = 'none', BuilderInterface $query = null, $missing = null)
6767
{
68-
$function = [
68+
$function = array_filter([
6969
'field_value_factor' => [
7070
'field' => $field,
7171
'factor' => $factor,
7272
'modifier' => $modifier,
73+
'missing' => $missing
7374
],
74-
];
75+
], function ($item) {
76+
return $item !== null;
77+
});
7578

7679
$this->applyFilter($function, $query);
7780

src/Search.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private function getEndpoint($type)
247247
/**
248248
* Returns queries inside BoolQuery instance.
249249
*
250-
* @return BuilderInterface
250+
* @return BoolQuery
251251
*/
252252
public function getQueries()
253253
{
@@ -311,7 +311,7 @@ public function addPostFilter(BuilderInterface $filter, $boolType = BoolQuery::M
311311
/**
312312
* Returns queries inside BoolFilter instance.
313313
*
314-
* @return BuilderInterface
314+
* @return BoolQuery
315315
*/
316316
public function getPostFilters()
317317
{

src/SearchEndpoint/SearchEndpointInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace ONGR\ElasticsearchDSL\SearchEndpoint;
1313

1414
use ONGR\ElasticsearchDSL\BuilderInterface;
15+
use ONGR\ElasticsearchDSL\Query\Compound\BoolQuery;
1516
use Symfony\Component\Serializer\Normalizer\NormalizableInterface;
1617

1718
/**
@@ -71,7 +72,7 @@ public function getAll($boolType = null);
7172
/**
7273
* Returns Bool filter or query instance with all builder objects inside.
7374
*
74-
* @return BuilderInterface
75+
* @return BoolQuery
7576
*/
7677
public function getBool();
7778
}

0 commit comments

Comments
 (0)