mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 03:47:02 +02:00
Detect the filters that are too deep and return an error
This commit is contained in:
parent
90f49eab6d
commit
32bd9f091f
2 changed files with 44 additions and 2 deletions
|
@ -118,10 +118,12 @@ impl<'a> FilterCondition<'a> {
|
|||
match self {
|
||||
FilterCondition::Condition { fid, .. } if depth == 0 => Some(fid),
|
||||
FilterCondition::Or(left, right) => {
|
||||
left.token_at_depth(depth - 1).or_else(|| right.token_at_depth(depth - 1))
|
||||
let depth = depth.saturating_sub(1);
|
||||
right.token_at_depth(depth).or_else(|| left.token_at_depth(depth))
|
||||
}
|
||||
FilterCondition::And(left, right) => {
|
||||
left.token_at_depth(depth - 1).or_else(|| right.token_at_depth(depth - 1))
|
||||
let depth = depth.saturating_sub(1);
|
||||
right.token_at_depth(depth).or_else(|| left.token_at_depth(depth))
|
||||
}
|
||||
FilterCondition::GeoLowerThan { point: [point, _], .. } if depth == 0 => Some(point),
|
||||
FilterCondition::GeoGreaterThan { point: [point, _], .. } if depth == 0 => Some(point),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue