-
Notifications
You must be signed in to change notification settings - Fork 1.2k
IndexOrDocValuesQuery and IndexSortSortedNumericDocValuesRangeQuery should only be counted once when computing maxClauseCount #14759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…hould only be counted once when computing maxClauseCount
This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog label to it and you will stop receiving this reminder on future updates to the PR. |
@romseygeek sorry for the direct ping but as you were involved in the original development of the query visitor API, do you have any opinions here? what is a leave in the query tree? |
QueryVisitor is supposed to be a query introspection API, so I wouldn't change its behaviour here. If the problem is that we want to be able to query multiple ranges without creating giant boolean queries, then I'd suggest instead looking at adding a |
My problem is that I want to use IndexOrDocValues query without changing the behaviour of the queries. This is a bit weird as the benefit of that query happens when it used on boolean queries but with the current implementation it is bogus as the behaviour change, e.g. it is not an optimisation anymore. For what you say, then the way we compute maxClauseCount is bogus and we should not be using the QueryVisitor? |
Well it's still an optimization, but just at the cost of a bigger query footprint. I think there are a couple of things pulling in different directions here:
So what you're running into there is the limit of that trade-off. I don't think anything is wrong here, I think this is telling us that if you want to do a disjunction over ranges then past a certain point just building a boolean query is going to be very inefficient and you should use a different type of query. Maybe one that we don't actually provide yet! |
I think the current behaviour is trappy, I would expect the test I post on the issue to pass. I agree though that building those big boolean queries is not optimal, but that's what users do sometimes. |
Maybe we should remove the concept of |
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the [email protected] list. Thank you for your contribution! |
see #14756
The idea proposed here is that both queries are just leaf queries and should only call once the method QueryVisitor#visitLeaf. For IndexOrDocValuesQuery is a bit more complicated because the query does not contain the field that is being queried, therefore it delegates the registration of the query to the visitor to the index query.
closes #14756