twosom commented on code in PR #12040: URL: https://github.com/apache/lucene/pull/12040#discussion_r1057622205
########## lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java: ########## @@ -346,21 +338,15 @@ public Query rewrite(IndexSearcher indexSearcher) throws IOException { if (clauseSets.get(Occur.FILTER).size() > 0) { final Set<Query> filters = new HashSet<>(clauseSets.get(Occur.FILTER)); boolean modified = false; - if (filters.size() > 1 || clauseSets.get(Occur.MUST).isEmpty() == false) { + if (filters.size() > 1 || !clauseSets.get(Occur.MUST).isEmpty()) { modified = filters.remove(new MatchAllDocsQuery()); } modified |= filters.removeAll(clauseSets.get(Occur.MUST)); if (modified) { BooleanQuery.Builder builder = new BooleanQuery.Builder(); builder.setMinimumNumberShouldMatch(getMinimumNumberShouldMatch()); - for (BooleanClause clause : clauses) { - if (clause.getOccur() != Occur.FILTER) { - builder.add(clause); - } - } - for (Query filter : filters) { - builder.add(filter, Occur.FILTER); - } + clauses.stream().filter(clause -> clause.getOccur() != Occur.FILTER).forEach(builder::add); + filters.forEach(filter -> builder.add(filter, Occur.FILTER)); Review Comment: What do you think about change this streams to like `caluses.stream().filter(BooleanClause::isNotFilter).forEach(builder::add);` -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org