jtibshirani commented on a change in pull request #204: URL: https://github.com/apache/lucene/pull/204#discussion_r664698038
########## File path: lucene/core/src/java/org/apache/lucene/search/comparators/DocComparator.java ########## @@ -81,7 +87,12 @@ public Integer value(int slot) { public DocLeafComparator(LeafReaderContext context) { this.docBase = context.docBase; if (enableSkipping) { - this.minDoc = topValue + 1; + // For a single sort on _doc, we want to skip all docs before topValue. + // For multiple fields sort on [_doc, other fields], we want to include docs with the same + // docID. + // This is needed in a distributed search, where there are docs from different indices with + // the same docID. + this.minDoc = singleSort ? topValue + 1 : topValue; Review comment: > For `NumericComparator` though this is not the case, and there could be huge number of docs with the same value, so extra optimization for `singleSort` is important. Oh I see, `NumericComparator` isn't just used in 'search after' cases so there could be many docs that share the same value. -- 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...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org