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:25:19 UTC

[lucene] branch branch_9x updated: LUCENE-10603: Mark SortedSetDocValues#NO_MORE_ORDS deprecated

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

gsmiller 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 4de355bd043 LUCENE-10603: Mark SortedSetDocValues#NO_MORE_ORDS deprecated
4de355bd043 is described below

commit 4de355bd04374bbd6c9ca5fe26b00f4f3dfe74a7
Author: Greg Miller <gs...@gmail.com>
AuthorDate: Tue Jun 21 05:47:32 2022 -0700

    LUCENE-10603: Mark SortedSetDocValues#NO_MORE_ORDS deprecated
---
 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 baca890717e..ffb51684725 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -69,7 +69,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.
    */