Skip to content

Apache Lucene open-source search software

LUCENE-4023: Forward port DisjunctionMaxScorer's access to children

Uwe Schindlera5bd0e63cb60
diff --git a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
index 9995062c2fe..6e87343cdc9 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DisjunctionMaxScorer.java
@@ -17,6 +17,9 @@ package org.apache.lucene.search;
*/
import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
/**
* The Scorer for DisjunctionMaxQuery. The union of all documents generated by the the subquery scorers
@@ -183,4 +186,12 @@ class DisjunctionMaxScorer extends Scorer {
}
}
+ @Override
+ public Collection<ChildScorer> getChildren() {
+ final ChildScorer[] children = new ChildScorer[numScorers];
+ for (int i = 0; i< numScorers; i++) {
+ children[i] = new ChildScorer(subScorers[i], BooleanClause.Occur.SHOULD.toString());
+ }
+ return Collections.unmodifiableCollection(Arrays.asList(children));
+ }
}