Skip to content

Commit

Permalink
add should to geoDistance
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed Sallam committed Mar 20, 2019
1 parent 71bd424 commit 70f0ba8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Builders/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public function prepareQuery()

// add geoDistance queries
foreach ($this->geoDistance as $geoDistance) {
$this->prepareGeoDistanceQueries($geoDistance);
$this->prepareGeoDistanceQueries($geoDistance, $boolOr);
}

// add SimpleQueryString
Expand Down Expand Up @@ -559,11 +559,12 @@ private function prepareMismatchQueries($mismatch)
* prepare geoDistance query
* @param $geoDistance
*/
private function prepareGeoDistanceQueries($geoDistance)
private function prepareGeoDistanceQueries($geoDistance, &$boolOr)
{
list($key, $location, $distance) = array_pad($geoDistance, 3, null);
$geoDistance = new GeoDistance($key, $location, $distance);
$this->filter->addFilter($geoDistance);

$boolOr->addShould($geoDistance);
}

/**
Expand Down

0 comments on commit 70f0ba8

Please sign in to comment.