fix(qdrant): reject mixed range and non-range filter operators

Raise ValueError when a filter dict for a single field combines range
operators (gt/gte/lt/lte) with non-range operators (eq/ne/in/nin/etc),
preventing silent data loss where the non-range conditions were dropped.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
kartik-mem0
2026-03-21 18:04:10 +05:30
co-authored by Claude Sonnet 4.6
parent fb430b1a32
commit b53507efd3
2 changed files with 17 additions and 1 deletions
+10
View File
@@ -541,5 +541,15 @@ class TestQdrantEnhancedFilters(unittest.TestCase):
self.qdrant._build_field_condition("field", {"unknown_op": "foo"})
self.assertIn("Unsupported", str(ctx.exception))
def test_mixed_range_and_non_range_raises_error(self):
"""Mixing range ops with non-range ops should raise ValueError."""
with self.assertRaises(ValueError):
self.qdrant._build_field_condition("priority", {"gte": 5, "ne": 10})
def test_mixed_range_and_eq_raises_error(self):
"""Mixing range ops with eq should raise ValueError."""
with self.assertRaises(ValueError):
self.qdrant._build_field_condition("score", {"gt": 0.5, "eq": 1.0})
def tearDown(self):
del self.qdrant