Skip to content

Commit

Permalink
Add NotInCondition to Memory Adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
ToshY committed Oct 15, 2024
1 parent c2bf749 commit 985c7b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/seal-memory-adapter/src/MemorySearcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ private function filterDocuments(Index $index, array $documents, object $filter)
if ([] === \array_intersect($filter->values, $values)) {
continue;
}
} elseif ($filter instanceof Condition\NotInCondition) {
if (\str_contains($filter->field, '.')) {
throw new \RuntimeException('Nested fields are not supported yet.');
}

$values = (array) ($document[$filter->field] ?? []);

if ([] !== \array_intersect($filter->values, $values)) {
continue;
}
} elseif ($filter instanceof Condition\NotEqualCondition) {
if (\str_contains($filter->field, '.')) {
throw new \RuntimeException('Nested fields are not supported yet.');
Expand Down

0 comments on commit 985c7b0

Please sign in to comment.