Skip to content

Commit 14a6f39

Browse files
committed
#819 Implement multiple rescore query
1 parent cc60e8f commit 14a6f39

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/Elastica/Query.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,18 @@ public function setSuggest(Suggest $suggest)
406406
*/
407407
public function setRescore($rescore)
408408
{
409-
return $this->setParam('rescore', $rescore->toArray());
409+
if (is_array($rescore)) {
410+
$buffer = [];
411+
412+
foreach($rescore as $rescoreQuery) {
413+
$buffer []= $rescoreQuery->toArray();
414+
}
415+
}
416+
else {
417+
$buffer = $rescore->toArray();
418+
}
419+
420+
return $this->setParam('rescore', $buffer);
410421
}
411422

412423
/**

0 commit comments

Comments
 (0)