From f485798685eacd3d67ca30358803f9879d00a73b Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Tue, 15 Jan 2013 21:16:49 +0000 Subject: [PATCH] LUCENE-4465: Let ConstantScoreQuery's Scorer return its child scorer. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1433652 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 3 +++ .../org/apache/lucene/search/ConstantScoreQuery.java | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 08d06e4c9b2..2080d4d725e 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -352,6 +352,9 @@ Bug Fixes DEFAULT_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 Behavior diff --git a/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java b/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java index 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 getChildren() { + if (docIdSetIterator instanceof Scorer) + return Collections.singletonList(new ChildScorer((Scorer) docIdSetIterator, "constant")); + else + return Collections.emptyList(); + } } @Override