You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gs...@apache.org on 2022/06/21 16:05:22 UTC

[lucene] branch main updated: LUCENE-10603: Mark SortedSetDocValues#NO_MORE_ORDS deprecated (#969)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 8f459eb0f9d LUCENE-10603: Mark SortedSetDocValues#NO_MORE_ORDS deprecated (#969)
8f459eb0f9d is described below

commit 8f459eb0f9d219af5610642c1027ec704b094dc3
Author: Greg Miller <gs...@gmail.com>
AuthorDate: Tue Jun 21 09:05:15 2022 -0700

    LUCENE-10603: Mark SortedSetDocValues#NO_MORE_ORDS deprecated (#969)
---
 lucene/CHANGES.txt                                          |  4 +++-
 .../java/org/apache/lucene/index/SortedSetDocValues.java    | 13 +++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 12c9c784af6..dc6bceb6672 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -71,7 +71,9 @@ Other
 
 API Changes
 ---------------------
-(No changes)
+
+* LUCENE-10603: SortedSetDocValues#NO_MORE_ORDS marked @deprecated in favor of iterating with
+  SortedSetDocValues#docValueCount(). (Greg Miller)
 
 New Features
 ---------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/SortedSetDocValues.java b/lucene/core/src/java/org/apache/lucene/index/SortedSetDocValues.java
index 422964c46df..cdcbcf96cea 100644
--- a/lucene/core/src/java/org/apache/lucene/index/SortedSetDocValues.java
+++ b/lucene/core/src/java/org/apache/lucene/index/SortedSetDocValues.java
@@ -32,13 +32,22 @@ public abstract class SortedSetDocValues extends DocValuesIterator {
   /** Sole constructor. (For invocation by subclass constructors, typically implicit.) */
   protected SortedSetDocValues() {}
 
-  /** When returned by {@link #nextOrd()} it means there are no more ordinals for the document. */
-  public static final long NO_MORE_ORDS = -1;
+  /**
+   * When returned by {@link #nextOrd()} it means there are no more ordinals for the document.
+   *
+   * @deprecated Will be removed in a future version. Please use {@link #docValueCount()} to know
+   *     the number of doc values for the current document up-front.
+   */
+  @Deprecated public static final long NO_MORE_ORDS = -1;
 
   /**
    * Returns the next ordinal for the current document. It is illegal to call this method after
    * {@link #advanceExact(int)} returned {@code false}.
    *
+   * <p>Note: Returns {@link #NO_MORE_ORDS} when the current document has no more ordinals. This
+   * behavior will be removed in a future version. Callers should use {@link #docValueCount()} to
+   * determine the number of values for the current document up-front.
+   *
    * @return next ordinal for the document, or {@link #NO_MORE_ORDS}. ordinals are dense, start at
    *     0, then increment by 1 for the next value in sorted order.
    */