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


##########
lucene/core/src/java/org/apache/lucene/index/SortedSetDocValuesWriter.java:
##########
@@ -439,29 +433,42 @@ private void set() {
   static final class DocOrds {
     final long[] offsets;
     final PackedLongValues ords;
+    final GrowableWriter growableWriter;
+
+    public static final int START_BITS_PER_VALUE = 2;
 

Review Comment:
   I suspect that most multi-valued fields still have a small number of bits 
per value e.g. 2 or 3, so START_BITS_PER_VALUE=2 makes sense to me.



##########
lucene/core/src/java/org/apache/lucene/index/SortedSetDocValuesWriter.java:
##########
@@ -350,6 +354,8 @@ static class SortingSortedSetDocValues extends 
SortedSetDocValues {
     private final DocOrds ords;
     private int docID = -1;
     private long ordUpto;
+    private boolean set;

Review Comment:
   maybe set the `count` on every call to `nextDoc` so that you don't have to 
maintain this `set` flag to know whether the count is set or not?



##########
lucene/core/src/java/org/apache/lucene/index/SortedSetDocValuesWriter.java:
##########
@@ -415,34 +420,55 @@ public BytesRef lookupOrd(long ord) throws IOException {
     public long getValueCount() {
       return in.getValueCount();
     }
+
+    private void set() {
+      if (set == false) {
+        assert docID >= 0;
+        count = (int) ords.growableWriter.get(docID);
+        set = true;
+      }
+    }
   }
 
   static final class DocOrds {
     final long[] offsets;
     final PackedLongValues ords;
+    final GrowableWriter growableWriter;
+
+    public static final int START_BITS_PER_VALUE = 2;
 
     DocOrds(
         int maxDoc,
         Sorter.DocMap sortMap,
         SortedSetDocValues oldValues,
         float acceptableOverheadRatio)
         throws IOException {
+      this(maxDoc, sortMap, oldValues, acceptableOverheadRatio, 
START_BITS_PER_VALUE);
+    }
+
+    DocOrds(
+        int maxDoc,
+        Sorter.DocMap sortMap,
+        SortedSetDocValues oldValues,
+        float acceptableOverheadRatio,
+        int bitsPerValue)
+        throws IOException {

Review Comment:
   Could we keep a single constructor?



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