benwtrent commented on code in PR #15124:
URL: https://github.com/apache/lucene/pull/15124#discussion_r2363122996
##########
lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java:
##########
@@ -649,15 +680,23 @@ public Query rewrite(IndexSearcher indexSearcher) throws
IOException {
@Override
public void visit(QueryVisitor visitor) {
QueryVisitor sub = visitor.getSubVisitor(Occur.MUST, this);
- for (BooleanClause.Occur occur : clauseSets.keySet()) {
+ for (Occur occur : Occur.cachedValues()) {
Review Comment:
If the cost is truly creating the iterator, maybe we can switch to something
that still uses the key set, like `clauseSets.entries().forEach((occur,
clauseSet) -> {clauseSet.forEach(clauseValue -> {...})})`;
It does seem weird to iterate the keys only to immediately use them to
rehash and get the values again.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]