jpountz commented on a change in pull request #734: LUCENE-8857: Introduce Custom Tiebreakers in TopDocs#merge URL: https://github.com/apache/lucene-solr/pull/734#discussion_r297563511
########## File path: lucene/core/src/java/org/apache/lucene/search/TopDocs.java ########## @@ -260,11 +291,12 @@ private static TopDocs mergeAux(Sort sort, int start, int size, TopDocs[] shardH } if (shard.scoreDocs != null && shard.scoreDocs.length > 0) { availHitCount += shard.scoreDocs.length; - queue.add(new ShardRef(shardIDX, setShardIndex == false)); + queue.add(new ShardRef(shardIDX)); } } final ScoreDoc[] hits; + final boolean unsetShardIndex = shardHits[0].scoreDocs[0].shardIndex == -1; Review comment: this is prone to out-of-bounds exceptions, you should find the first TopDocs instance that has a non-empty ScoreDoc[] if any ---------------------------------------------------------------- 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 With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org