s1monw commented on a change in pull request #1908: URL: https://github.com/apache/lucene-solr/pull/1908#discussion_r492719968
########## File path: lucene/core/src/java/org/apache/lucene/index/SortedSetDocValuesWriter.java ########## @@ -379,4 +352,31 @@ public long getValueCount() { return in.getValueCount(); } } + + static final class DocOrds { + final long[] offsets; + final PackedLongValues ords; + + DocOrds(int maxDoc, Sorter.DocMap sortMap, SortedSetDocValues oldValues, float acceptableOverheadRatio) throws IOException { + offsets = new long[maxDoc]; + PackedLongValues.Builder builder = PackedLongValues.packedBuilder(acceptableOverheadRatio); + long ordOffset = 1; // 0 marks docs with no values + int docID; + while ((docID = oldValues.nextDoc()) != NO_MORE_DOCS) { + int newDocID = sortMap.oldToNew(docID); + long startOffset = ordOffset; + long ord; + while ((ord = oldValues.nextOrd()) != NO_MORE_ORDS) { + builder.add(ord + 1); + ordOffset++; + } + if (startOffset != ordOffset) { // do we have any values? + offsets[newDocID] = startOffset; + builder.add(0); // 0 ord marks next value Review comment: agreed, I didn't do it since it would have impacted readability too much IMO ---------------------------------------------------------------- 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. 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