Skip to content

Commit 39d3aee

Browse files
committed
Fix filter depth limitation
1 parent e4fdc3d commit 39d3aee

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

learn/inner_workings/known_limitations.mdx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,29 @@ If your query is `Hello - World`:
7171

7272
## Maximum filter depth
7373

74-
**Limitation:** Meilisearch does not accept searches with more than 2000 `OR` filters.
74+
**Limitation:** Meilisearch accepts filtering searches (using the `filter` search parameter) with a maximum filtering depth of 2000.
7575

76-
**Explanation:** `OR` filters create nested structures which can lead to a stack overflow.
76+
**Explanation:** Regarding filering, a the depth is increased when mixing and alterning `AND` and `OR` operators filters creating nested structures which can lead to a stack overflow.
7777

7878
### Example
7979

80-
Either of these filter expressions would cause a search query to fail:
80+
The following filter with the chained `OR` operators corresponds to a depth of 1:
8181

8282
```sql
83-
user = 1 OR user = 2 […] OR user = 1500 OR user = 1501 […] OR user = 2000 OR user = 2001
83+
user = 1 OR user = 2 […] OR user = 10000
8484
```
8585

86-
```json
87-
[
88-
["user = 1", "user = 2", [], "user = 1500", "user = 1501", [], "user = 2000", "user = 2001"]
89-
]
90-
```
86+
We got the same behavior with chained `AND` operators: the depth is still 1.
87+
88+
However, when mixing and alterning `AND` and `OR` operators, we create depths:
89+
90+
```sql
91+
# AND is nested inside the ORs, so we have a depth of 2
92+
id = 1 OR id = 2 AND id = 3
93+
94+
# Here we have a depth of 4
95+
id = 1 OR (id = 2 AND (id = 3 OR (id = 4 AND id = 5)))
96+
```
9197

9298
## Size of integer fields
9399

0 commit comments

Comments
 (0)