Skip to content

Commit

Permalink
Cleanup must filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Torann committed Mar 31, 2017
1 parent 9a0427e commit f5fe2f8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Hunter.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,20 +423,20 @@ public function getSearchParams($term, array $options = [])

// Check for must filters
if ($filter_musts = Arr::get($options, 'filter_musts')) {
foreach(array_filter($filter_musts) as $filter=>$value) {
foreach($filter_musts as $filter=>$value) {

// TODO: This sucks...fix it. Version 2 made it so that
// all tags had to be present, not just some of them
if (is_array($value)) {
foreach($value as $k=>$v) {
foreach(array_filter($value) as $k=>$v) {
$params['body']['query']['bool']['must'][] = [
'term' => [
$filter => $v,
],
];
}
}
else {
else if($value !== '') {
$params['body']['query']['bool']['must'][] = [
'term' => [
$filter => $value,
Expand Down

0 comments on commit f5fe2f8

Please sign in to comment.