Apache Solr open-source search software
LUCENE-4465: Let ConstantScoreQuery's Scorer return its child scorer.
Uwe Schindlerf485798685ea
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 08d06e4c9b2..2080d4d725e 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -352,6 +352,9 @@ Bug FixesDEFAULT_ARTICLES list passed to ElisionFilter. (David Leunen via Steve Rowe)* LUCENE-4671: Fix CharsRef.subSequence method. (Tim Smith via Robert Muir)++* LUCENE-4465: Let ConstantScoreQuery's Scorer return its child scorer.+ (selckin via Uwe Schindler)Changes in Runtime Behaviordiff --git a/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java b/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.javaindex 71add6d0b48..f6fd987b979 100644--- a/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java+++ b/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java@@ -24,6 +24,8 @@ import org.apache.lucene.util.Bits;import org.apache.lucene.util.ToStringUtils;import java.io.IOException;+import java.util.Collection;+import java.util.Collections;import java.util.Set;/**@@ -248,6 +250,14 @@ public class ConstantScoreQuery extends Query {return super.score(collector, max, firstDocID);}}++ @Override+ public Collection<ChildScorer> getChildren() {+ if (docIdSetIterator instanceof Scorer)+ return Collections.singletonList(new ChildScorer((Scorer) docIdSetIterator, "constant"));+ else+ return Collections.emptyList();+ }}@Override