Skip to content

Commit d24a709

Browse files
committed
Non ordered multi term choices should not throw elasticsearch exception.
1 parent 6ea9937 commit d24a709

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

Filters/Widget/AbstractSingleRequestValueFilter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function getState(Request $request)
3737
$value = $request->get($this->getRequestField());
3838

3939
if (isset($value) && $value !== '') {
40+
$value = is_array($value) ? array_values($value) : $value;
4041
$state->setActive(true);
4142
$state->setValue($value);
4243
$state->setUrlParameters([$this->getRequestField() => $value]);

Tests/Functional/Filters/Widget/Choice/MultiTermChoiceTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ public function getTestResultsData()
7878
// Case #2 all elements.
7979
$out[] = [new Request(['choice' => ['red', 'green', 'blue']]), ['1', '2', '3', '4', '5']];
8080

81+
// Case #3 non ordered choices.
82+
$out[] = [new Request(['choice' => [0 => 'black', 2 => 'red']]), ['1', '3']];
83+
8184
return $out;
8285
}
8386

0 commit comments

Comments
 (0)