You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2018/02/12 16:43:19 UTC
[2/2] lucene-solr:branch_7x: LUCENE-8127: Speed up rewriteNoScoring
when there are no MUST clauses.
LUCENE-8127: Speed up rewriteNoScoring when there are no MUST clauses.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9d66dc27
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9d66dc27
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9d66dc27
Branch: refs/heads/branch_7x
Commit: 9d66dc27328816a845d4f448bf2efa33f289207e
Parents: cda002d
Author: Adrien Grand <jp...@gmail.com>
Authored: Mon Feb 12 14:39:17 2018 +0100
Committer: Adrien Grand <jp...@gmail.com>
Committed: Mon Feb 12 17:43:14 2018 +0100
----------------------------------------------------------------------
lucene/CHANGES.txt | 3 +++
lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java | 3 +++
2 files changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9d66dc27/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index d667b56..6e6c9d3 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -60,6 +60,9 @@ Improvements
classes to use the optimized variants through the MR-JAR mechanism.
(Uwe Schindler, Robert Muir, Adrien Grand, Mike McCandless)
+* LUCENE-8127: Speed up rewriteNoScoring when there are no MUST clauses.
+ (Michael Braun via Adrien Grand)
+
Bug Fixes
* LUCENE-8077: Fixed bug in how CheckIndex verifies doc-value iterators.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9d66dc27/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java b/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
index a3f5ae0..7d487cc 100644
--- a/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
@@ -183,6 +183,9 @@ public class BooleanQuery extends Query implements Iterable<BooleanClause> {
}
private BooleanQuery rewriteNoScoring() {
+ if (clauseSets.get(Occur.MUST).size() == 0) {
+ return this;
+ }
BooleanQuery.Builder newQuery = new BooleanQuery.Builder();
newQuery.setMinimumNumberShouldMatch(getMinimumNumberShouldMatch());
for (BooleanClause clause : clauses) {