jpountz commented on code in PR #967:
URL: https://github.com/apache/lucene/pull/967#discussion_r907352353


##########
lucene/core/src/java/org/apache/lucene/index/SortedSetDocValuesWriter.java:
##########
@@ -415,34 +419,45 @@ public BytesRef lookupOrd(long ord) throws IOException {
     public long getValueCount() {
       return in.getValueCount();
     }
+
+    private void initCount() {
+      assert docID >= 0;
+      ordUpto = ords.offsets[docID] - 1;
+      count = (int) ords.docValueCounts.get(docID);
+      limit = ordUpto + count;
+    }
   }
 
   static final class DocOrds {
     final long[] offsets;
     final PackedLongValues ords;
+    final GrowableWriter docValueCounts;
+
+    public static final int START_BITS_PER_VALUE = 2;
 
     DocOrds(
         int maxDoc,
         Sorter.DocMap sortMap,
         SortedSetDocValues oldValues,
-        float acceptableOverheadRatio)
+        float acceptableOverheadRatio,
+        int bitsPerValue)
         throws IOException {
       offsets = new long[maxDoc];
       PackedLongValues.Builder builder = 
PackedLongValues.packedBuilder(acceptableOverheadRatio);
-      long ordOffset = 1; // 0 marks docs with no values
+      docValueCounts = new GrowableWriter(bitsPerValue, maxDoc, 
acceptableOverheadRatio);
+      long ordOffset = 1;

Review Comment:
   Let's start at 0 to not have to subtract 0 all the time in `initCount()`?



-- 
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

Reply via email to