Skip to content

Commit 64f8ff5

Browse files
authored
fix: propagate limit for filter (#400)
* fix: ignore limit for filter * fix: allow limit for weaviate filter
1 parent 34d2534 commit 64f8ff5

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

docarray/array/mixins/find.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def find(
141141
)
142142
elif query is None:
143143
if isinstance(filter, dict):
144-
return self._filter(filter)
144+
return self._filter(filter, limit=limit)
145145
else:
146146
raise ValueError('filter must be dict when query is None')
147147
elif isinstance(query, str) or (

docarray/array/storage/weaviate/find.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
List,
66
Dict,
77
Optional,
8+
Union,
89
)
910

1011
import numpy as np
@@ -79,8 +80,7 @@ def _find_similar_vectors(
7980
return DocumentArray(docs)
8081

8182
def _filter(
82-
self,
83-
filter: Dict,
83+
self, filter: Dict, limit: Optional[Union[int, float]] = 20
8484
) -> 'DocumentArray':
8585
"""Returns a subset of documents by filtering by the given filter (Weaviate `where` filter).
8686
@@ -94,6 +94,7 @@ def _filter(
9494
self._client.query.get(self._class_name, '_serialized')
9595
.with_additional('id')
9696
.with_where(filter)
97+
.with_limit(limit)
9798
.do()
9899
)
99100

0 commit comments

Comments
 (0)