HoustonPutman commented on code in PR #3222: URL: https://github.com/apache/solr/pull/3222#discussion_r2017531006
########## solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java: ########## @@ -1984,18 +1982,22 @@ public ScoreMode scoreMode() { populateNextCursorMarkFromTopDocs(qr, cmd, topDocs); nDocsReturned = topDocs.scoreDocs.length; - ids = new int[nDocsReturned]; - scores = needScores ? new float[nDocsReturned] : null; - for (int i = 0; i < nDocsReturned; i++) { - ScoreDoc scoreDoc = topDocs.scoreDocs[i]; - ids[i] = scoreDoc.doc; - if (scores != null) scores[i] = scoreDoc.score; + int sliceLen = Math.min(lastDocRequested, nDocsReturned); + if (sliceLen < 0) { + sliceLen = 0; + } + if (!needScores) { + int[] ids = new int[nDocsReturned]; + for (int i = 0; i < nDocsReturned; i++) { + ScoreDoc scoreDoc = topDocs.scoreDocs[i]; + ids[i] = scoreDoc.doc; + } + docList = new DocSlice(0, sliceLen, ids, null, totalHits, maxScore, hitsRelation); + } else { + docList = new TopDocsSlice(0, sliceLen, topDocs, totalHits, maxScore, hitsRelation); } Review Comment: Ok, I think this is the last question I have about this PR. Why not always use the `TopDocsSlice` here? -- 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. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org 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