From 9eeab8c4a69b64afacd83a041bb6dd97570cd943 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Tue, 13 Dec 2022 10:32:15 -0500 Subject: [PATCH] Remove deprecated API in 10.x (#11998) --- .../lucene/index/BaseCompositeReader.java | 14 ---- .../org/apache/lucene/index/CodecReader.java | 15 ---- .../lucene/index/DocValuesLeafReader.java | 10 --- .../lucene/index/FilterCodecReader.java | 12 --- .../apache/lucene/index/FilterLeafReader.java | 12 --- .../org/apache/lucene/index/IndexReader.java | 76 ------------------- .../lucene/index/ParallelLeafReader.java | 26 ------- .../lucene/index/SegmentCoreReaders.java | 23 ------ .../apache/lucene/index/SegmentReader.java | 33 -------- .../apache/lucene/search/IndexSearcher.java | 36 --------- .../index/TestSegmentToThreadMapping.java | 8 -- .../highlight/TermVectorLeafReader.java | 11 --- .../search/uhighlight/UnifiedHighlighter.java | 9 --- .../lucene/index/memory/MemoryIndex.java | 15 ---- .../tests/index/AssertingLeafReader.java | 6 -- .../index/BaseStoredFieldsFormatTestCase.java | 5 -- .../tests/index/FieldFilterLeafReader.java | 11 +-- .../tests/index/MergeReaderWrapper.java | 24 ------ .../tests/index/MismatchedLeafReader.java | 5 -- .../lucene/tests/search/QueryUtils.java | 9 --- 20 files changed, 1 insertion(+), 359 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/index/BaseCompositeReader.java b/lucene/core/src/java/org/apache/lucene/index/BaseCompositeReader.java index 6c6182a65b6..6c091b36766 100644 --- a/lucene/core/src/java/org/apache/lucene/index/BaseCompositeReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/BaseCompositeReader.java @@ -111,13 +111,6 @@ public abstract class BaseCompositeReader extends Composi starts[subReaders.length] = this.maxDoc; } - @Override - public final Fields getTermVectors(int docID) throws IOException { - ensureOpen(); - final int i = readerIndex(docID); // find subreader num - return subReaders[i].getTermVectors(docID - starts[i]); // dispatch to subreader - } - @Override public final TermVectors termVectors() throws IOException { ensureOpen(); @@ -164,13 +157,6 @@ public abstract class BaseCompositeReader extends Composi return maxDoc; } - @Override - public final void document(int docID, StoredFieldVisitor visitor) throws IOException { - ensureOpen(); - final int i = readerIndex(docID); // find subreader num - subReaders[i].document(docID - starts[i], visitor); // dispatch to subreader - } - @Override public final StoredFields storedFields() throws IOException { ensureOpen(); diff --git a/lucene/core/src/java/org/apache/lucene/index/CodecReader.java b/lucene/core/src/java/org/apache/lucene/index/CodecReader.java index 7220756d0cf..530dba16857 100644 --- a/lucene/core/src/java/org/apache/lucene/index/CodecReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/CodecReader.java @@ -83,21 +83,6 @@ public abstract class CodecReader extends LeafReader { */ public abstract KnnVectorsReader getVectorReader(); - // intentionally throw UOE for deprecated APIs: keep CodecReader clean! - // (IndexWriter should not be triggering threadlocals in any way) - - @Override - @Deprecated - public void document(int docID, StoredFieldVisitor visitor) throws IOException { - throw new UnsupportedOperationException("deprecated document access is not supported"); - } - - @Override - @Deprecated - public Fields getTermVectors(int docID) throws IOException { - throw new UnsupportedOperationException("deprecated term vector access is not supported"); - } - @Override public final StoredFields storedFields() throws IOException { final StoredFields reader = getFieldsReader(); diff --git a/lucene/core/src/java/org/apache/lucene/index/DocValuesLeafReader.java b/lucene/core/src/java/org/apache/lucene/index/DocValuesLeafReader.java index 31b50d4f381..8a013d6af5b 100644 --- a/lucene/core/src/java/org/apache/lucene/index/DocValuesLeafReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/DocValuesLeafReader.java @@ -68,11 +68,6 @@ abstract class DocValuesLeafReader extends LeafReader { throw new UnsupportedOperationException(); } - @Override - public final Fields getTermVectors(int docID) throws IOException { - throw new UnsupportedOperationException(); - } - @Override public final TermVectors termVectors() throws IOException { throw new UnsupportedOperationException(); @@ -88,11 +83,6 @@ abstract class DocValuesLeafReader extends LeafReader { throw new UnsupportedOperationException(); } - @Override - public final void document(int docID, StoredFieldVisitor visitor) throws IOException { - throw new UnsupportedOperationException(); - } - @Override public final StoredFields storedFields() throws IOException { throw new UnsupportedOperationException(); diff --git a/lucene/core/src/java/org/apache/lucene/index/FilterCodecReader.java b/lucene/core/src/java/org/apache/lucene/index/FilterCodecReader.java index 4859fd684dc..e2a60291ab8 100644 --- a/lucene/core/src/java/org/apache/lucene/index/FilterCodecReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/FilterCodecReader.java @@ -84,18 +84,6 @@ public abstract class FilterCodecReader extends CodecReader { return in.getPostingsReader(); } - @Override - @Deprecated - public void document(int docID, StoredFieldVisitor visitor) throws IOException { - in.document(docID, visitor); - } - - @Override - @Deprecated - public Fields getTermVectors(int docID) throws IOException { - return in.getTermVectors(docID); - } - @Override public Bits getLiveDocs() { return in.getLiveDocs(); diff --git a/lucene/core/src/java/org/apache/lucene/index/FilterLeafReader.java b/lucene/core/src/java/org/apache/lucene/index/FilterLeafReader.java index 11f8c223352..4331f0da727 100644 --- a/lucene/core/src/java/org/apache/lucene/index/FilterLeafReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/FilterLeafReader.java @@ -357,12 +357,6 @@ public abstract class FilterLeafReader extends LeafReader { return in.searchNearestVectors(field, target, k, acceptDocs, visitedLimit); } - @Override - public Fields getTermVectors(int docID) throws IOException { - ensureOpen(); - return in.getTermVectors(docID); - } - @Override public TermVectors termVectors() throws IOException { ensureOpen(); @@ -387,12 +381,6 @@ public abstract class FilterLeafReader extends LeafReader { return in.storedFields(); } - @Override - public void document(int docID, StoredFieldVisitor visitor) throws IOException { - ensureOpen(); - in.document(docID, visitor); - } - @Override protected void doClose() throws IOException { in.close(); diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexReader.java b/lucene/core/src/java/org/apache/lucene/index/IndexReader.java index 400ea6c7b88..2a3c6dbead2 100644 --- a/lucene/core/src/java/org/apache/lucene/index/IndexReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/IndexReader.java @@ -23,10 +23,7 @@ import java.util.List; import java.util.Set; import java.util.WeakHashMap; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.DocumentStoredFieldVisitor; import org.apache.lucene.store.AlreadyClosedException; -import org.apache.lucene.util.Bits; /** * IndexReader is an abstract class, providing an interface for accessing a point-in-time view of an @@ -308,30 +305,6 @@ public abstract class IndexReader implements Closeable { return System.identityHashCode(this); } - /** - * Retrieve term vectors for this document, or null if term vectors were not indexed. The returned - * Fields instance acts like a single-document inverted index (the docID will be 0). - * - * @deprecated use {@link #termVectors()} to retrieve one or more documents - */ - @Deprecated - public abstract Fields getTermVectors(int docID) throws IOException; - - /** - * Retrieve term vector for this document and field, or null if term vectors were not indexed. The - * returned Fields instance acts like a single-document inverted index (the docID will be 0). - * - * @deprecated use {@link #termVectors()} to retrieve one or more documents - */ - @Deprecated - public final Terms getTermVector(int docID, String field) throws IOException { - Fields vectors = getTermVectors(docID); - if (vectors == null) { - return null; - } - return vectors.terms(field); - } - /** * Returns a {@link TermVectors} reader for the term vectors of this index. * @@ -376,55 +349,6 @@ public abstract class IndexReader implements Closeable { return maxDoc() - numDocs(); } - /** - * Expert: visits the fields of a stored document, for custom processing/loading of each field. If - * you simply want to load all fields, use {@link #document(int)}. If you want to load a subset, - * use {@link DocumentStoredFieldVisitor}. - * - * @deprecated use {@link #storedFields()} to retrieve one or more documents - */ - @Deprecated - public abstract void document(int docID, StoredFieldVisitor visitor) throws IOException; - - /** - * Returns the stored fields of the nth Document in this - * index. This is just sugar for using {@link DocumentStoredFieldVisitor}. - * - *

NOTE: for performance reasons, this method does not check if the requested document - * is deleted, and therefore asking for a deleted document may yield unspecified results. Usually - * this is not required, however you can test if the doc is deleted by checking the {@link Bits} - * returned from {@link MultiBits#getLiveDocs}. - * - *

NOTE: only the content of a field is returned, if that field was stored during - * indexing. Metadata like boost, omitNorm, IndexOptions, tokenized, etc., are not preserved. - * - * @throws CorruptIndexException if the index is corrupt - * @throws IOException if there is a low-level IO error - * @deprecated use {@link #storedFields()} to retrieve one or more documents - */ - // TODO: we need a separate StoredField, so that the - // Document returned here contains that class not - // IndexableField - @Deprecated - public final Document document(int docID) throws IOException { - final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(); - document(docID, visitor); - return visitor.getDocument(); - } - - /** - * Like {@link #document(int)} but only loads the specified fields. Note that this is simply sugar - * for {@link DocumentStoredFieldVisitor#DocumentStoredFieldVisitor(Set)}. - * - * @deprecated use {@link #storedFields()} to retrieve one or more documents - */ - @Deprecated - public final Document document(int docID, Set fieldsToLoad) throws IOException { - final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad); - document(docID, visitor); - return visitor.getDocument(); - } - /** * Returns a {@link StoredFields} reader for the stored fields of this index. * diff --git a/lucene/core/src/java/org/apache/lucene/index/ParallelLeafReader.java b/lucene/core/src/java/org/apache/lucene/index/ParallelLeafReader.java index 323177bbadb..ed36fc9196c 100644 --- a/lucene/core/src/java/org/apache/lucene/index/ParallelLeafReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/ParallelLeafReader.java @@ -265,14 +265,6 @@ public class ParallelLeafReader extends LeafReader { return maxDoc; } - @Override - public void document(int docID, StoredFieldVisitor visitor) throws IOException { - ensureOpen(); - for (final LeafReader reader : storedFieldsReaders) { - reader.document(docID, visitor); - } - } - @Override public StoredFields storedFields() throws IOException { ensureOpen(); @@ -316,24 +308,6 @@ public class ParallelLeafReader extends LeafReader { return null; } - @Override - public Fields getTermVectors(int docID) throws IOException { - ensureOpen(); - ParallelFields fields = null; - for (Map.Entry ent : tvFieldToReader.entrySet()) { - String fieldName = ent.getKey(); - Terms vector = ent.getValue().getTermVector(docID, fieldName); - if (vector != null) { - if (fields == null) { - fields = new ParallelFields(); - } - fields.addField(fieldName, vector); - } - } - - return fields; - } - @Override public TermVectors termVectors() throws IOException { ensureOpen(); diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java b/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java index df733b11196..9e0cdc86f92 100644 --- a/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java @@ -39,7 +39,6 @@ import org.apache.lucene.index.IndexReader.ClosedListener; import org.apache.lucene.store.AlreadyClosedException; import org.apache.lucene.store.Directory; import org.apache.lucene.store.IOContext; -import org.apache.lucene.util.CloseableThreadLocal; import org.apache.lucene.util.IOUtils; /** Holds core readers that are shared (unchanged) when SegmentReader is cloned or reopened */ @@ -68,26 +67,6 @@ final class SegmentCoreReaders { */ final FieldInfos coreFieldInfos; - // TODO: make a single thread local w/ a - // Thingy class holding fieldsReader, termVectorsReader, - // normsProducer - - final CloseableThreadLocal fieldsReaderLocal = - new CloseableThreadLocal() { - @Override - protected StoredFieldsReader initialValue() { - return fieldsReaderOrig.clone(); - } - }; - - final CloseableThreadLocal termVectorsLocal = - new CloseableThreadLocal() { - @Override - protected TermVectorsReader initialValue() { - return (termVectorsReaderOrig == null) ? null : termVectorsReaderOrig.clone(); - } - }; - private final Set coreClosedListeners = Collections.synchronizedSet(new LinkedHashSet()); @@ -190,8 +169,6 @@ final class SegmentCoreReaders { if (ref.decrementAndGet() == 0) { try (Closeable finalizer = this::notifyCoreClosedListeners) { IOUtils.close( - termVectorsLocal, - fieldsReaderLocal, fields, termVectorsReaderOrig, fieldsReaderOrig, diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentReader.java b/lucene/core/src/java/org/apache/lucene/index/SegmentReader.java index 8e9afb1fc28..7a255c456de 100644 --- a/lucene/core/src/java/org/apache/lucene/index/SegmentReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentReader.java @@ -18,7 +18,6 @@ package org.apache.lucene.index; import java.io.IOException; import java.util.Collections; -import java.util.Objects; import java.util.Set; import java.util.concurrent.CopyOnWriteArraySet; import org.apache.lucene.codecs.Codec; @@ -245,38 +244,6 @@ public final class SegmentReader extends CodecReader { return si.info.maxDoc(); } - /* Support for deprecated threadlocal document/vectors APIs */ - - @Override - public final void document(int docID, StoredFieldVisitor visitor) throws IOException { - Objects.checkIndex(docID, maxDoc()); - getThreadLocalFieldsReader().document(docID, visitor); - } - - @Override - public final Fields getTermVectors(int docID) throws IOException { - Objects.checkIndex(docID, maxDoc()); - TermVectorsReader termVectorsReader = getThreadLocalTermVectorsReader(); - if (termVectorsReader == null) { - return null; - } - return termVectorsReader.get(docID); - } - - @Deprecated - private TermVectorsReader getThreadLocalTermVectorsReader() { - ensureOpen(); - return core.termVectorsLocal.get(); - } - - @Deprecated - private StoredFieldsReader getThreadLocalFieldsReader() { - ensureOpen(); - return core.fieldsReaderLocal.get(); - } - - /* end support for deprecated threadlocal document/vectors APIs */ - @Override public TermVectorsReader getTermVectorsReader() { ensureOpen(); diff --git a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java index ce93bd9cef8..227d16dc721 100644 --- a/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java +++ b/lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java @@ -24,14 +24,12 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Objects; -import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; import java.util.concurrent.Future; import java.util.concurrent.FutureTask; import java.util.concurrent.ThreadPoolExecutor; import java.util.function.Supplier; -import org.apache.lucene.document.Document; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReaderContext; @@ -39,7 +37,6 @@ import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.QueryTimeout; import org.apache.lucene.index.ReaderUtil; -import org.apache.lucene.index.StoredFieldVisitor; import org.apache.lucene.index.StoredFields; import org.apache.lucene.index.Term; import org.apache.lucene.index.Terms; @@ -379,39 +376,6 @@ public class IndexSearcher { return reader; } - /** - * Sugar for .getIndexReader().document(docID) - * - * @see IndexReader#document(int) - * @deprecated Use {@link #storedFields()} to access fields for one or more documents - */ - @Deprecated - public Document doc(int docID) throws IOException { - return reader.document(docID); - } - - /** - * Sugar for .getIndexReader().document(docID, fieldVisitor) - * - * @see IndexReader#document(int, StoredFieldVisitor) - * @deprecated Use {@link #storedFields()} to access fields for one or more documents - */ - @Deprecated - public void doc(int docID, StoredFieldVisitor fieldVisitor) throws IOException { - reader.document(docID, fieldVisitor); - } - - /** - * Sugar for .getIndexReader().document(docID, fieldsToLoad) - * - * @see IndexReader#document(int, Set) - * @deprecated Use {@link #storedFields()} to access fields for one or more documents - */ - @Deprecated - public Document doc(int docID, Set fieldsToLoad) throws IOException { - return reader.document(docID, fieldsToLoad); - } - /** * Returns a {@link StoredFields} reader for the stored fields of this index. * diff --git a/lucene/core/src/test/org/apache/lucene/index/TestSegmentToThreadMapping.java b/lucene/core/src/test/org/apache/lucene/index/TestSegmentToThreadMapping.java index 62d62d538a0..3500ffc378a 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestSegmentToThreadMapping.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestSegmentToThreadMapping.java @@ -66,11 +66,6 @@ public class TestSegmentToThreadMapping extends LuceneTestCase { return null; } - @Override - public Fields getTermVectors(int doc) { - return null; - } - @Override public TermVectors termVectors() { return TermVectors.EMPTY; @@ -125,9 +120,6 @@ public class TestSegmentToThreadMapping extends LuceneTestCase { @Override protected void doClose() {} - @Override - public void document(int doc, StoredFieldVisitor visitor) {} - @Override public StoredFields storedFields() { return new StoredFields() { diff --git a/lucene/highlighter/src/java/org/apache/lucene/search/highlight/TermVectorLeafReader.java b/lucene/highlighter/src/java/org/apache/lucene/search/highlight/TermVectorLeafReader.java index ca044d91318..b96e5484e62 100644 --- a/lucene/highlighter/src/java/org/apache/lucene/search/highlight/TermVectorLeafReader.java +++ b/lucene/highlighter/src/java/org/apache/lucene/search/highlight/TermVectorLeafReader.java @@ -173,14 +173,6 @@ public class TermVectorLeafReader extends LeafReader { @Override public void checkIntegrity() throws IOException {} - @Override - public Fields getTermVectors(int docID) throws IOException { - if (docID != 0) { - return null; - } - return fields; - } - @Override public TermVectors termVectors() throws IOException { return new TermVectors() { @@ -205,9 +197,6 @@ public class TermVectorLeafReader extends LeafReader { return 1; } - @Override - public void document(int docID, StoredFieldVisitor visitor) throws IOException {} - @Override public StoredFields storedFields() throws IOException { return new StoredFields() { diff --git a/lucene/highlighter/src/java/org/apache/lucene/search/uhighlight/UnifiedHighlighter.java b/lucene/highlighter/src/java/org/apache/lucene/search/uhighlight/UnifiedHighlighter.java index 615db5ecd5f..4f2d4af6da0 100644 --- a/lucene/highlighter/src/java/org/apache/lucene/search/uhighlight/UnifiedHighlighter.java +++ b/lucene/highlighter/src/java/org/apache/lucene/search/uhighlight/UnifiedHighlighter.java @@ -1452,15 +1452,6 @@ public class UnifiedHighlighter { super(in); } - @Override - public Fields getTermVectors(int docID) throws IOException { - if (docID != lastDocId) { - lastDocId = docID; - tvFields = in.getTermVectors(docID); - } - return tvFields; - } - @Override public TermVectors termVectors() throws IOException { TermVectors orig = in.termVectors(); diff --git a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java index f3628282c4a..e3943bd47ba 100644 --- a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java +++ b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java @@ -1803,15 +1803,6 @@ public class MemoryIndex { } } - @Override - public Fields getTermVectors(int docID) { - if (docID == 0) { - return memoryFields; - } else { - return null; - } - } - @Override public TermVectors termVectors() { return new TermVectors() { @@ -1838,12 +1829,6 @@ public class MemoryIndex { return 1; } - @Override - public void document(int docID, StoredFieldVisitor visitor) throws IOException { - if (DEBUG) System.err.println("MemoryIndexReader.document"); - storedFields().document(docID, visitor); - } - @Override public StoredFields storedFields() { return new StoredFields() { diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/index/AssertingLeafReader.java b/lucene/test-framework/src/java/org/apache/lucene/tests/index/AssertingLeafReader.java index c3d1973fb48..c61c88ff143 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/tests/index/AssertingLeafReader.java +++ b/lucene/test-framework/src/java/org/apache/lucene/tests/index/AssertingLeafReader.java @@ -110,12 +110,6 @@ public class AssertingLeafReader extends FilterLeafReader { return terms == null ? null : new AssertingTerms(terms); } - @Override - public Fields getTermVectors(int docID) throws IOException { - Fields fields = super.getTermVectors(docID); - return fields == null ? null : new AssertingFields(fields); - } - @Override public TermVectors termVectors() throws IOException { return new AssertingTermVectors(super.termVectors()); diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseStoredFieldsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseStoredFieldsFormatTestCase.java index d7c16e5567c..2c7aadab81f 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseStoredFieldsFormatTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/tests/index/BaseStoredFieldsFormatTestCase.java @@ -620,11 +620,6 @@ public abstract class BaseStoredFieldsFormatTestCase extends BaseIndexFileFormat super(in); } - @Override - public void document(int docID, StoredFieldVisitor visitor) throws IOException { - super.document(maxDoc() - 1 - docID, visitor); - } - @Override public StoredFields storedFields() throws IOException { StoredFields orig = in.storedFields(); diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/index/FieldFilterLeafReader.java b/lucene/test-framework/src/java/org/apache/lucene/tests/index/FieldFilterLeafReader.java index 05d32d7f373..ffb7f3b7425 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/tests/index/FieldFilterLeafReader.java +++ b/lucene/test-framework/src/java/org/apache/lucene/tests/index/FieldFilterLeafReader.java @@ -69,11 +69,6 @@ public final class FieldFilterLeafReader extends FilterLeafReader { return fieldInfos; } - @Override - public Fields getTermVectors(int docID) throws IOException { - return termVectors().get(docID); - } - @Override public TermVectors termVectors() throws IOException { TermVectors orig = super.termVectors(); @@ -92,11 +87,6 @@ public final class FieldFilterLeafReader extends FilterLeafReader { }; } - @Override - public void document(final int docID, final StoredFieldVisitor visitor) throws IOException { - storedFields().document(docID, visitor); - } - @Override public StoredFields storedFields() throws IOException { StoredFields orig = super.storedFields(); @@ -184,6 +174,7 @@ public final class FieldFilterLeafReader extends FilterLeafReader { return sb.append(fields).append(')').toString(); } + @SuppressWarnings("unused") private class FieldFilterFields extends FilterFields { public FieldFilterFields(Fields in) { diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/index/MergeReaderWrapper.java b/lucene/test-framework/src/java/org/apache/lucene/tests/index/MergeReaderWrapper.java index a4822f073ff..dbe3e1242c9 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/tests/index/MergeReaderWrapper.java +++ b/lucene/test-framework/src/java/org/apache/lucene/tests/index/MergeReaderWrapper.java @@ -18,7 +18,6 @@ package org.apache.lucene.tests.index; import java.io.IOException; -import java.util.Objects; import org.apache.lucene.codecs.DocValuesProducer; import org.apache.lucene.codecs.FieldsProducer; import org.apache.lucene.codecs.NormsProducer; @@ -29,7 +28,6 @@ import org.apache.lucene.index.CodecReader; import org.apache.lucene.index.DocValuesType; import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.FieldInfos; -import org.apache.lucene.index.Fields; import org.apache.lucene.index.LeafMetaData; import org.apache.lucene.index.LeafReader; import org.apache.lucene.index.NumericDocValues; @@ -37,7 +35,6 @@ import org.apache.lucene.index.PointValues; import org.apache.lucene.index.SortedDocValues; import org.apache.lucene.index.SortedNumericDocValues; import org.apache.lucene.index.SortedSetDocValues; -import org.apache.lucene.index.StoredFieldVisitor; import org.apache.lucene.index.StoredFields; import org.apache.lucene.index.TermVectors; import org.apache.lucene.index.Terms; @@ -204,16 +201,6 @@ class MergeReaderWrapper extends LeafReader { in.checkIntegrity(); } - @Override - public Fields getTermVectors(int docID) throws IOException { - ensureOpen(); - checkBounds(docID); - if (vectors == null) { - return null; - } - return vectors.get(docID); - } - @Override public TermVectors termVectors() throws IOException { ensureOpen(); @@ -250,13 +237,6 @@ class MergeReaderWrapper extends LeafReader { return in.maxDoc(); } - @Override - public void document(int docID, StoredFieldVisitor visitor) throws IOException { - ensureOpen(); - checkBounds(docID); - store.document(docID, visitor); - } - @Override public StoredFields storedFields() throws IOException { ensureOpen(); @@ -278,10 +258,6 @@ class MergeReaderWrapper extends LeafReader { return in.getReaderCacheHelper(); } - private void checkBounds(int docID) { - Objects.checkIndex(docID, maxDoc()); - } - @Override public String toString() { return "MergeReaderWrapper(" + in + ")"; diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/index/MismatchedLeafReader.java b/lucene/test-framework/src/java/org/apache/lucene/tests/index/MismatchedLeafReader.java index bbf2adbdc04..bf7c18e8ff1 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/tests/index/MismatchedLeafReader.java +++ b/lucene/test-framework/src/java/org/apache/lucene/tests/index/MismatchedLeafReader.java @@ -47,11 +47,6 @@ public class MismatchedLeafReader extends FilterLeafReader { return shuffled; } - @Override - public void document(int docID, StoredFieldVisitor visitor) throws IOException { - in.document(docID, new MismatchedVisitor(visitor)); - } - @Override public StoredFields storedFields() throws IOException { final StoredFields inStoredFields = in.storedFields(); diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/search/QueryUtils.java b/lucene/test-framework/src/java/org/apache/lucene/tests/search/QueryUtils.java index 3c697dcfcf3..a1e6d49c4d2 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/tests/search/QueryUtils.java +++ b/lucene/test-framework/src/java/org/apache/lucene/tests/search/QueryUtils.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.Random; import org.apache.lucene.index.BinaryDocValues; import org.apache.lucene.index.FieldInfos; -import org.apache.lucene.index.Fields; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.LeafMetaData; import org.apache.lucene.index.LeafReader; @@ -255,11 +254,6 @@ public class QueryUtils { @Override public void checkIntegrity() throws IOException {} - @Override - public Fields getTermVectors(int docID) throws IOException { - return null; - } - @Override public TermVectors termVectors() { return TermVectors.EMPTY; @@ -275,9 +269,6 @@ public class QueryUtils { return maxDoc; } - @Override - public void document(int docID, StoredFieldVisitor visitor) throws IOException {} - @Override public StoredFields storedFields() { return new StoredFields() {