cpoerschke commented on a change in pull request #151: URL: https://github.com/apache/solr/pull/151#discussion_r641708552
########## 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: Thanks! Yes, a `SortedHitQueueManager` style class was the key idea, the FooBar queue within queue sketching was just one possible implementation speculation. -- 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