You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by vi...@apache.org on 2025/07/08 06:13:22 UTC

(lucene) branch branch_10x updated: Deprecate MergeSpecification#segString(Directory) (#14908)

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

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


The following commit(s) were added to refs/heads/branch_10x by this push:
     new 2a5ae4b9d6d Deprecate MergeSpecification#segString(Directory) (#14908)
2a5ae4b9d6d is described below

commit 2a5ae4b9d6d0af0956c6185c42927ef5368a8a20
Author: kitoha <ki...@gmail.com>
AuthorDate: Tue Jul 8 15:08:20 2025 +0900

    Deprecate MergeSpecification#segString(Directory) (#14908)
---
 lucene/CHANGES.txt                                      |  2 ++
 .../src/java/org/apache/lucene/index/MergePolicy.java   | 17 ++++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 8e7fbef4c24..9cca524fe05 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -15,6 +15,8 @@ API Changes
 * GITHUB#14426: Support determining desired off-heap memory requirements through
   KnnVectorsReader::getOffHeapByteSize (Chris Hegarty)
 
+* GITHUB#14899: Deprecate MergeSpecification#segString(Directory) (kitoha)
+
 New Features
 ---------------------
 * GITHUB#14404: Introducing DocValuesMultiRangeQuery.SortedNumericStabbingBuilder into sandbox.
diff --git a/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java b/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
index d66f5648c03..42616c59e5c 100644
--- a/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
+++ b/lucene/core/src/java/org/apache/lucene/index/MergePolicy.java
@@ -494,16 +494,15 @@ public abstract class MergePolicy {
       merges.add(merge);
     }
 
-    // TODO: deprecate me (dir is never used!  and is sometimes difficult to provide!)
-    /** Returns a description of the merges in this specification. */
+    /**
+     * Returns a description of the merges in this specification
+     *
+     * @deprecated Use {@link #toString()} instead. The {@code Directory} parameter is ignored and
+     *     will be removed in a future release.
+     */
+    @Deprecated
     public String segString(Directory dir) {
-      StringBuilder b = new StringBuilder();
-      b.append("MergeSpec:\n");
-      final int count = merges.size();
-      for (int i = 0; i < count; i++) {
-        b.append("  ").append(1 + i).append(": ").append(merges.get(i).segString());
-      }
-      return b.toString();
+      return toString();
     }
 
     @Override