You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/09/22 13:10:49 UTC

[GitHub] [lucene-solr] s1monw commented on a change in pull request #1908: LUCENE-9539: Use more compact datastructures for sorting doc-values

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org