tomglk commented on a change in pull request #151: URL: https://github.com/apache/solr/pull/151#discussion_r641405433
########## File path: solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java ########## @@ -865,7 +866,19 @@ protected void mergeIds(ResponseBuilder rb, ShardRequest sreq) { // Merge the docs via a priority queue so we don't have to sort *all* of the // documents... we only need to order the top (rows+start) - final ShardFieldSortedHitQueue queue = new ShardFieldSortedHitQueue(sortFields, ss.getOffset() + ss.getCount(), rb.req.getSearcher()); + ShardFieldSortedHitQueue queue = new ShardFieldSortedHitQueueWithSameShardCompareSkip(sortFields, ss.getOffset() + ss.getCount(), rb.req.getSearcher()); + + ShardFieldSortedHitQueue reRankQueue = null; + int reRankDocsSize = 0; + if(rb.getRankQuery() != null){ + final RankQuery rankQuery = rb.getRankQuery(); + if(rankQuery instanceof AbstractReRankQuery){ + reRankDocsSize = ((AbstractReRankQuery) rankQuery).getReRankDocs(); + reRankQueue = new ShardFieldSortedHitQueueWithSameShardCompareSkip(new SortField[]{SortField.FIELD_SCORE}, Math.min(reRankDocsSize, ss.getCount()), rb.req.getSearcher()); + + queue = new ShardFieldSortedHitQueue(sortFields, ss.getOffset() + ss.getCount(), rb.req.getSearcher()); + } + } Review comment: We did not fully understand your remarks but agree that the `mergeIds( )` is too complex. Therefore we extracted the logic of handling multiple queues to a new class. You can see this in 47075d2. -- 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...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org