Make AND+OR filters n-ary (store a vector of subfilters instead of 2)

NOTE: The token_at_depth is method is a bit useless now, as the only
cases where there would be a toke at depth 1000 are the cases where
the parser already stack-overflowed earlier.

Example: (((((... (x=1) ...)))))
This commit is contained in:
Loïc Lecrenier 2022-06-20 18:46:57 +02:00
parent f55034ed54
commit 258c3dd563
3 changed files with 118 additions and 110 deletions

View file

@ -745,10 +745,9 @@ async fn main() -> anyhow::Result<()> {
};
let condition = match (filters, facet_filters) {
(Some(filters), Some(facet_filters)) => Some(FilterCondition::And(
Box::new(filters.into()),
Box::new(facet_filters.into()),
)),
(Some(filters), Some(facet_filters)) => {
Some(FilterCondition::And(vec![filters.into(), facet_filters.into()]))
}
(Some(condition), None) | (None, Some(condition)) => Some(condition.into()),
_otherwise => None,
};