@@ -220,18 +220,42 @@ def contains_none(self, val: FilterValuesList) -> _Filters:
220220
221221 def equal (self , val : FilterValues ) -> _Filters :
222222 """Filter on whether the property is equal to the given value."""
223+ if isinstance (val , list ) and len (val ) == 0 :
224+ raise WeaviateInvalidInputError (
225+ "Filtering on empty lists is not supported by Weaviate. "
226+ "To filter by property length, use "
227+ "Filter.by_property('prop', length=True).equal(0)"
228+ )
223229 return _FilterValue (target = self ._target_path (), value = val , operator = _Operator .EQUAL )
224230
225231 def not_equal (self , val : FilterValues ) -> _Filters :
226232 """Filter on whether the property is not equal to the given value."""
233+ if isinstance (val , list ) and len (val ) == 0 :
234+ raise WeaviateInvalidInputError (
235+ "Filtering on empty lists is not supported by Weaviate. "
236+ "To filter by property length, use "
237+ "Filter.by_property('prop', length=True).equal(0)"
238+ )
227239 return _FilterValue (target = self ._target_path (), value = val , operator = _Operator .NOT_EQUAL )
228240
229241 def less_than (self , val : FilterValues ) -> _Filters :
230242 """Filter on whether the property is less than the given value."""
243+ if isinstance (val , list ) and len (val ) == 0 :
244+ raise WeaviateInvalidInputError (
245+ "Filtering on empty lists is not supported by Weaviate. "
246+ "To filter by property length, use "
247+ "Filter.by_property('prop', length=True).equal(0)"
248+ )
231249 return _FilterValue (target = self ._target_path (), value = val , operator = _Operator .LESS_THAN )
232250
233251 def less_or_equal (self , val : FilterValues ) -> _Filters :
234252 """Filter on whether the property is less than or equal to the given value."""
253+ if isinstance (val , list ) and len (val ) == 0 :
254+ raise WeaviateInvalidInputError (
255+ "Filtering on empty lists is not supported by Weaviate. "
256+ "To filter by property length, use "
257+ "Filter.by_property('prop', length=True).equal(0)"
258+ )
235259 return _FilterValue (
236260 target = self ._target_path (),
237261 value = val ,
@@ -240,6 +264,12 @@ def less_or_equal(self, val: FilterValues) -> _Filters:
240264
241265 def greater_than (self , val : FilterValues ) -> _Filters :
242266 """Filter on whether the property is greater than the given value."""
267+ if isinstance (val , list ) and len (val ) == 0 :
268+ raise WeaviateInvalidInputError (
269+ "Filtering on empty lists is not supported by Weaviate. "
270+ "To filter by property length, use "
271+ "Filter.by_property('prop', length=True).equal(0)"
272+ )
243273 return _FilterValue (
244274 target = self ._target_path (),
245275 value = val ,
@@ -248,6 +278,12 @@ def greater_than(self, val: FilterValues) -> _Filters:
248278
249279 def greater_or_equal (self , val : FilterValues ) -> _Filters :
250280 """Filter on whether the property is greater than or equal to the given value."""
281+ if isinstance (val , list ) and len (val ) == 0 :
282+ raise WeaviateInvalidInputError (
283+ "Filtering on empty lists is not supported by Weaviate. "
284+ "To filter by property length, use "
285+ "Filter.by_property('prop', length=True).equal(0)"
286+ )
251287 return _FilterValue (
252288 target = self ._target_path (),
253289 value = val ,
0 commit comments