Skip to content

Commit

Permalink
Merge pull request #61 from Aniket-IN/feature/add-wherenotin-support
Browse files Browse the repository at this point in the history
Add `whereNotIn` support
  • Loading branch information
babenkoivan authored May 27, 2024
2 parents 485eb1f + f9bbfb8 commit cb7cb4b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Factories/SearchParametersFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ protected function makeFilter(Builder $builder): ?array
$filter = $filter->merge($whereIns);
}

if (property_exists($builder, 'whereNotIns')) {
$whereNotIns = collect($builder->whereNotIns)->map(static fn (array $values, string $field) => [
'terms' => [$field => $values],
])->values();

$filter = $filter->merge([[
'bool' => [
'must_not' => $whereNotIns
]
]]);
}

return $filter->isEmpty() ? null : $filter->all();
}

Expand Down

0 comments on commit cb7cb4b

Please sign in to comment.