You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2022/06/02 07:34:28 UTC

[lucene] branch branch_9x updated: LUCENE-10598: Fix docValueCount() on Lucene80 sparse sorted set doc values.

This is an automated email from the ASF dual-hosted git repository.

jpountz pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 3020b4b5555 LUCENE-10598: Fix docValueCount() on Lucene80 sparse sorted set doc values.
3020b4b5555 is described below

commit 3020b4b555599d5f934e074f4d9d86f1fb40cfb3
Author: Adrien Grand <jp...@gmail.com>
AuthorDate: Thu Jun 2 09:33:04 2022 +0200

    LUCENE-10598: Fix docValueCount() on Lucene80 sparse sorted set doc values.
---
 .../lucene80/Lucene80DocValuesProducer.java             | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesProducer.java b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesProducer.java
index ad047456e14..32a898db09d 100644
--- a/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesProducer.java
+++ b/lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene80/Lucene80DocValuesProducer.java
@@ -1653,15 +1653,21 @@ final class Lucene80DocValuesProducer extends DocValuesProducer {
           return disi.advanceExact(target);
         }
 
-        @Override
-        public long nextOrd() throws IOException {
+        private boolean set() {
           if (set == false) {
             final int index = disi.index();
-            final long start = addresses.get(index);
-            this.start = start + 1;
+            start = addresses.get(index);
             end = addresses.get(index + 1L);
             set = true;
-            return ords.get(start);
+            return true;
+          }
+          return false;
+        }
+
+        @Override
+        public long nextOrd() throws IOException {
+          if (set()) {
+            return ords.get(start++);
           } else if (start == end) {
             return NO_MORE_ORDS;
           } else {
@@ -1671,6 +1677,7 @@ final class Lucene80DocValuesProducer extends DocValuesProducer {
 
         @Override
         public long docValueCount() {
+          set();
           return end - start;
         }
       };