Skip to content

Commit

Permalink
#819 Implement multiple rescore query
Browse files Browse the repository at this point in the history
  • Loading branch information
ebuildy committed Apr 22, 2015
1 parent cc60e8f commit 14a6f39
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/Elastica/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,18 @@ public function setSuggest(Suggest $suggest)
*/
public function setRescore($rescore)
{
return $this->setParam('rescore', $rescore->toArray());
if (is_array($rescore)) {
$buffer = [];

foreach($rescore as $rescoreQuery) {
$buffer []= $rescoreQuery->toArray();
}
}
else {
$buffer = $rescore->toArray();
}

return $this->setParam('rescore', $buffer);
}

/**
Expand Down

0 comments on commit 14a6f39

Please sign in to comment.