Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-8909: remove deprecated IndexWriter#getFieldNames()

Munendra S N6104f55ac040
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 94726d83123..f50a5781feb 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -27,6 +27,9 @@ API Changes
and apply to all queries, rather than only booleans. (Atri Sharma, Adrien
Grand, Alan Woodward)
+* LUCENE-8909: The deprecated IndexWriter#getFieldNames() method has been removed.
+ (Adrien Grand, Munendra S N)
+
Improvements
* LUCENE-8757: When provided with an ExecutorService to run queries across
@@ -48,6 +51,11 @@ Other
======================= Lucene 8.3.0 =======================
+API Changes
+
+* LUCENE-8909: IndexWriter#getFieldNames() method is used to get fields present in index. After LUCENE-8316, this
+ method is no longer required. Hence, deprecate IndexWriter#getFieldNames() method. (Adrien Grand, Munendra S N)
+
Improvements
* LUCENE-8874: Show SPI names instead of class names in Luke Analysis tab. (Tomoko Uchida)
diff --git a/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java b/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java
index 193fbdf5906..d9076d767d0 100644
--- a/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java
+++ b/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java
@@ -18,16 +18,14 @@ package org.apache.lucene.index;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Objects;
-import java.util.Set;
-import java.util.Arrays;
-import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
@@ -424,10 +422,6 @@ public class FieldInfos implements Iterable<FieldInfo> {
}
}
- synchronized Set<String> getFieldNames() {
- return Collections.unmodifiableSet(new HashSet<>(nameToNumber.keySet()));
- }
-
synchronized void clear() {
numberToName.clear();
nameToNumber.clear();
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
index 3b110eca7b4..14f96d4ba2f 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
@@ -1841,22 +1841,6 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable,
return flushDeletesCount.get();
}
- /**
- * Return an unmodifiable set of all field names as visible
- * from this IndexWriter, across all segments of the index.
- * Useful for knowing which fields exist, before {@link #updateDocValues(Term, Field...)} is
- * attempted. We could phase out this method if
- * {@link #updateDocValues(Term, Field...)} could create the non-existent
- * docValues fields as necessary, instead of throwing
- * IllegalArgumentException for attempts to update non-existent
- * docValues fields.
- * @lucene.internal
- * @lucene.experimental
- */
- public Set<String> getFieldNames() {
- return globalFieldNumberMap.getFieldNames(); // FieldNumbers#getFieldNames() returns an unmodifiableSet
- }
-
final String newSegmentName() {
// Cannot synchronize on IndexWriter because that causes
// deadlock