magibney commented on a change in pull request #592: URL: https://github.com/apache/solr/pull/592#discussion_r799561070
########## File path: solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java ########## @@ -1405,14 +1446,32 @@ private void getDocListC(QueryResult qr, QueryCommand cmd) throws IOException { out.docSet = getDocSet(cmd.getQuery(), cmd.getFilter()); List<Query> filterList = cmd.getFilterList(); if (filterList != null && !filterList.isEmpty()) { - out.docSet = out.docSet.intersection(getDocSet(cmd.getFilterList())); + out.docSet = DocSetUtil.getDocSet(out.docSet.intersection(getDocSet(filterList)), this); } } // todo: there could be a sortDocSet that could take a list of // the filters instead of anding them first... // perhaps there should be a multi-docset-iterator - sortDocSet(qr, cmd); + if (needSort) { + fullSortCount++; + sortDocSet(qr, cmd); + } else { + skipSortCount++; + // put unsorted list in place + out.docList = constantScoreDocList(cmd.getOffset(), cmd.getLen(), out.docSet); + if (0 == cmd.getSupersetMaxDoc()) { + // this is the only case where `cursorMark && !needSort` + qr.setNextCursorMark(cmd.getCursorMark()); Review comment: Ahh good catch. Will add one, and for `rows=1` (which should _not_ hit the sort optimization) -- 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