You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Boolean expressions use `AND` / `OR` with parentheses for grouping.
80
+
**Note:**`LIKE` and `CONTAINS` are only supported for document predicates (via `WHERE_DOCUMENT`), not for metadata filters. This is a ChromaDB limitation.
81
+
82
+
Both `WHERE` and `WHERE_DOCUMENT` support boolean expressions with `AND` / `OR` and parentheses for grouping.
Supports equality, inequality, numeric comparisons, `IN`/`NOT IN`, and `BETWEEN`.
37
+
38
+
**Note:**`LIKE` and `CONTAINS` are NOT supported on metadata (ChromaDB limitation).
39
+
Use `WHERE_DOCUMENT` for text/pattern matching.
40
+
41
+
**Note:**`BETWEEN` with mixed int/float types may behave unexpectedly due to ChromaDB type coercion. Use matching types (integer boundaries for integer metadata).
42
+
43
+
**Important:** Different filter types (metadata vs. document) can **only** be combined with `AND`, not `OR` (ChromaDB limitation). Within each type, use `OR` freely.
38
44
39
45
```sql
46
+
-- Valid: metadata AND document
40
47
WHEREmetadata.category='outerwear'
41
-
ANDmetadata.tags CONTAINS 'waterproof'
48
+
ANDmetadata.price BETWEEN 50AND150
49
+
AND document CONTAINS 'waterproof'
50
+
51
+
-- Invalid: metadata OR document ❌
52
+
-- WHERE metadata.category = 'outerwear' OR document CONTAINS 'sale'
42
53
```
43
54
44
55
### Document (`WHERE_DOCUMENT`)
45
56
46
-
Applied after metadata filters. Supports `CONTAINS` and `%value%``LIKE`
47
-
patterns.
57
+
Applied after metadata filters. Supports text search operators: `CONTAINS`, `NOT CONTAINS`, `LIKE`, `NOT LIKE`, `REGEX`, `NOT REGEX`.
58
+
59
+
**These operators ONLY work with WHERE_DOCUMENT**, not with WHERE (metadata).
60
+
61
+
**Boolean expressions supported**: Use `AND`, `OR`, and parentheses for complex filters.
62
+
63
+
**Important:** Use `WHERE_DOCUMENT`**once** at the beginning, then combine predicates with boolean operators. Don't repeat `WHERE_DOCUMENT` for each condition.
48
64
49
65
```sql
66
+
-- Simple filter
50
67
WHERE_DOCUMENT LIKE'%gore-tex%'
68
+
69
+
-- OR: Match multiple terms (don't repeat WHERE_DOCUMENT!)
WHERE_DOCUMENT NOT REGEX '\d{3}-\d{2}-\d{4}'-- Exclude SSN patterns
51
89
```
52
90
91
+
**Note:** Text operators are **case-sensitive**. `WHERE_DOCUMENT CONTAINS 'urgent'` will NOT match "Urgent" or "URGENT". To handle multiple cases, use OR: `CONTAINS 'urgent' OR CONTAINS 'Urgent'`, or use REGEX with `(?i)` flag: `REGEX '(?i)urgent'`.
0 commit comments