gf2121 commented on code in PR #12610: URL: https://github.com/apache/lucene/pull/12610#discussion_r1346202698
########## lucene/core/src/java/org/apache/lucene/util/bkd/MutablePointTreeReaderUtils.java: ########## @@ -81,6 +86,40 @@ protected int byteAt(int i, int k) { return (reader.getDocID(i) >>> Math.max(0, shift)) & 0xff; } } + + @Override + protected Sorter getFallbackSorter(int k) { + return new InPlaceMergeSorter() { + @Override + protected int compare(int i, int j) { + if (k < config.packedBytesLength) { + reader.getValue(i, scratch1); + reader.getValue(j, scratch2); + int v = + Arrays.compareUnsigned( + scratch1.bytes, + scratch1.offset + k, + scratch1.offset + scratch1.length, + scratch2.bytes, + scratch2.offset + k, + scratch2.offset + scratch2.length); + if (v != 0) { + return v; + } + } + if (bitsPerDocId == 0) { Review Comment: Yes, see this [line](https://github.com/apache/lucene/blob/eb14a1a0a69757dcbda4829c4a160ecd1a5530ad/lucene/core/src/java/org/apache/lucene/util/bkd/MutablePointTreeReaderUtils.java#L59). We are avoiding doc id comparing with a stable sort if index sorting in not enabled :) -- 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