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 2021/10/05 12:50:11 UTC

[GitHub] [lucene] gsmiller commented on a change in pull request #330: LUCENE-10133: Specialize the write path for sorted doc values.

gsmiller commented on a change in pull request #330:
URL: https://github.com/apache/lucene/pull/330#discussion_r722206683



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesConsumer.java
##########
@@ -496,6 +516,25 @@ public void addSortedField(FieldInfo field, DocValuesProducer valuesProducer) th
 
   private void doAddSortedField(FieldInfo field, DocValuesProducer valuesProducer)
       throws IOException {
+
+    int numDocsWithValue = 0;
+    MinMaxTracker blockMinMax = new MinMaxTracker();
+
+    SortedDocValues sorted = valuesProducer.getSorted(field);
+    for (int doc = sorted.nextDoc(); doc < DocIdSetIterator.NO_MORE_DOCS; doc = sorted.nextDoc()) {
+      final int v = sorted.ordValue();
+      blockMinMax.update(v);
+      if (blockMinMax.numValues == NUMERIC_BLOCK_SIZE) {
+        blockMinMax.nextBlock();
+      }
+      numDocsWithValue++;
+    }
+    blockMinMax.finish();
+

Review comment:
       Maybe a comment for a future reader lacking context?
   
   ```suggestion
   
   // ordinals will always have a min value of 0 and a max of length - 1:
   ```




-- 
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-unsubscribe@lucene.apache.org

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