}
int topN = firstResult.queryResult().size();
// Need to use the length of the resultsArr array, since the slots will be based on the position in the resultsArr array
TopDocs[] shardTopDocs = new TopDocs[resultsArr.length()];
if (firstResult.includeFetch()) {
// if we did both query and fetch on the same go, we have fetched all the docs from each shards already, use them...
// this is also important since we shortcut and fetch only docs from "from" and up to "size"
topN *= sortedResults.length;
}
for (AtomicArray.Entry<? extends QuerySearchResultProvider> sortedResult : sortedResults) {