Skip to content

Commit

Permalink
feat: Add NOT IN filter for Qdrant vector store (#14791)
Browse files Browse the repository at this point in the history
  • Loading branch information
leehuwuj authored Jul 17, 2024
1 parent 54f2da6 commit 01852a1
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,19 @@ def _build_subfilter(self, filters: MetadataFilters) -> Filter:
match=MatchAny(any=values),
)
)
elif subfilter.operator == FilterOperator.NIN:
# match none of the values
# https://qdrant.tech/documentation/concepts/filtering/#match-except
if isinstance(subfilter.value, List):
values = [str(val) for val in subfilter.value]
else:
values = str(subfilter.value).split(",")
conditions.append(
FieldCondition(
key=subfilter.key,
match=MatchExcept(**{"except": values}),
)
)

filter = Filter()
if filters.condition == FilterCondition.AND:
Expand Down

0 comments on commit 01852a1

Please sign in to comment.