For example, if a QueryBuilder contains two different filters of the form: x > 1000 and 500 < x < 1500, we can merge it into just one filter 1000 < x < 1500, or in some cases, remove the filter altogether, e.g., as in x > 2000 and 500 < x < 1500.
In #138765, I introduced a QueryBuilder range filter merger, but only for a very specific use case (COUNT(*) BY ROUNDTO, basically). This was intentionally very conservative to minimize its impact, but there's no principal reason we couldn't perform this merging for any QueryBuilder! This makes pushing queries down to Lucene cheaper, since the queries themselves are simpler.
For example, if a
QueryBuildercontains two different filters of the form:x > 1000and500 < x < 1500, we can merge it into just one filter1000 < x < 1500, or in some cases, remove the filter altogether, e.g., as inx > 2000and500 < x < 1500.In #138765, I introduced a
QueryBuilderrange filter merger, but only for a very specific use case (COUNT(*) BY ROUNDTO, basically). This was intentionally very conservative to minimize its impact, but there's no principal reason we couldn't perform this merging for anyQueryBuilder! This makes pushing queries down to Lucene cheaper, since the queries themselves are simpler.