jpountz commented on a change in pull request #1567:
URL: https://github.com/apache/lucene-solr/pull/1567#discussion_r438575844



##########
File path: lucene/core/src/test/org/apache/lucene/search/MultiCollectorTest.java
##########
@@ -163,4 +163,64 @@ public void testCacheScoresIfNecessary() throws 
IOException {
     reader.close();
     dir.close();
   }
+  
+  public void testScorerWrappingForTopScores() throws IOException {
+    Directory dir = newDirectory();
+    RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
+    iw.addDocument(new Document());
+    iw.commit();

Review comment:
       no need to commit, the follow-up call to getReader() creates a NRT 
segment anyway

##########
File path: lucene/core/src/java/org/apache/lucene/search/MultiCollector.java
##########
@@ -143,32 +143,43 @@ public LeafCollector getLeafCollector(LeafReaderContext 
context) throws IOExcept
     private final boolean cacheScores;
     private final LeafCollector[] collectors;
     private int numCollectors;
+    private final float[] minScores;
+    private final boolean skipNonCompetitiveScores;
 
-    private MultiLeafCollector(List<LeafCollector> collectors, boolean 
cacheScores) {
+    private MultiLeafCollector(List<LeafCollector> collectors, boolean 
cacheScores, boolean skipNonCompetitive) {
       this.collectors = collectors.toArray(new 
LeafCollector[collectors.size()]);
       this.cacheScores = cacheScores;
       this.numCollectors = this.collectors.length;
+      this.skipNonCompetitiveScores = skipNonCompetitive;
+      this.minScores = new float[this.skipNonCompetitiveScores ? 
this.numCollectors : 0];

Review comment:
       Let's make the array null when `skipNonCompetitiveScores` is false?
   ```suggestion
         this.minScores = this.skipNonCompetitiveScores ? new float[ 
this.numCollectors] : null;
   ```




----------------------------------------------------------------
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.

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

Reply via email to