mirror of https://github.com/apache/lucene.git
Remove deprecated API in 10.x (#11998)
This commit is contained in:
parent
47f8c1baa2
commit
9eeab8c4a6
|
@ -111,13 +111,6 @@ public abstract class BaseCompositeReader<R extends IndexReader> extends Composi
|
||||||
starts[subReaders.length] = this.maxDoc;
|
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
|
@Override
|
||||||
public final TermVectors termVectors() throws IOException {
|
public final TermVectors termVectors() throws IOException {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
@ -164,13 +157,6 @@ public abstract class BaseCompositeReader<R extends IndexReader> extends Composi
|
||||||
return maxDoc;
|
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
|
@Override
|
||||||
public final StoredFields storedFields() throws IOException {
|
public final StoredFields storedFields() throws IOException {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
|
|
@ -83,21 +83,6 @@ public abstract class CodecReader extends LeafReader {
|
||||||
*/
|
*/
|
||||||
public abstract KnnVectorsReader getVectorReader();
|
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
|
@Override
|
||||||
public final StoredFields storedFields() throws IOException {
|
public final StoredFields storedFields() throws IOException {
|
||||||
final StoredFields reader = getFieldsReader();
|
final StoredFields reader = getFieldsReader();
|
||||||
|
|
|
@ -68,11 +68,6 @@ abstract class DocValuesLeafReader extends LeafReader {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final Fields getTermVectors(int docID) throws IOException {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final TermVectors termVectors() throws IOException {
|
public final TermVectors termVectors() throws IOException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
@ -88,11 +83,6 @@ abstract class DocValuesLeafReader extends LeafReader {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public final void document(int docID, StoredFieldVisitor visitor) throws IOException {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final StoredFields storedFields() throws IOException {
|
public final StoredFields storedFields() throws IOException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|
|
@ -84,18 +84,6 @@ public abstract class FilterCodecReader extends CodecReader {
|
||||||
return in.getPostingsReader();
|
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
|
@Override
|
||||||
public Bits getLiveDocs() {
|
public Bits getLiveDocs() {
|
||||||
return in.getLiveDocs();
|
return in.getLiveDocs();
|
||||||
|
|
|
@ -357,12 +357,6 @@ public abstract class FilterLeafReader extends LeafReader {
|
||||||
return in.searchNearestVectors(field, target, k, acceptDocs, visitedLimit);
|
return in.searchNearestVectors(field, target, k, acceptDocs, visitedLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fields getTermVectors(int docID) throws IOException {
|
|
||||||
ensureOpen();
|
|
||||||
return in.getTermVectors(docID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TermVectors termVectors() throws IOException {
|
public TermVectors termVectors() throws IOException {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
@ -387,12 +381,6 @@ public abstract class FilterLeafReader extends LeafReader {
|
||||||
return in.storedFields();
|
return in.storedFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void document(int docID, StoredFieldVisitor visitor) throws IOException {
|
|
||||||
ensureOpen();
|
|
||||||
in.document(docID, visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doClose() throws IOException {
|
protected void doClose() throws IOException {
|
||||||
in.close();
|
in.close();
|
||||||
|
|
|
@ -23,10 +23,7 @@ import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
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.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
|
* 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);
|
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.
|
* 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();
|
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 <code>n</code><sup>th</sup> <code>Document</code> in this
|
|
||||||
* index. This is just sugar for using {@link DocumentStoredFieldVisitor}.
|
|
||||||
*
|
|
||||||
* <p><b>NOTE:</b> 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}.
|
|
||||||
*
|
|
||||||
* <p><b>NOTE:</b> 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<String> 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.
|
* Returns a {@link StoredFields} reader for the stored fields of this index.
|
||||||
*
|
*
|
||||||
|
|
|
@ -265,14 +265,6 @@ public class ParallelLeafReader extends LeafReader {
|
||||||
return maxDoc;
|
return maxDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void document(int docID, StoredFieldVisitor visitor) throws IOException {
|
|
||||||
ensureOpen();
|
|
||||||
for (final LeafReader reader : storedFieldsReaders) {
|
|
||||||
reader.document(docID, visitor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StoredFields storedFields() throws IOException {
|
public StoredFields storedFields() throws IOException {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
@ -316,24 +308,6 @@ public class ParallelLeafReader extends LeafReader {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fields getTermVectors(int docID) throws IOException {
|
|
||||||
ensureOpen();
|
|
||||||
ParallelFields fields = null;
|
|
||||||
for (Map.Entry<String, LeafReader> 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
|
@Override
|
||||||
public TermVectors termVectors() throws IOException {
|
public TermVectors termVectors() throws IOException {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
|
|
@ -39,7 +39,6 @@ import org.apache.lucene.index.IndexReader.ClosedListener;
|
||||||
import org.apache.lucene.store.AlreadyClosedException;
|
import org.apache.lucene.store.AlreadyClosedException;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.IOContext;
|
import org.apache.lucene.store.IOContext;
|
||||||
import org.apache.lucene.util.CloseableThreadLocal;
|
|
||||||
import org.apache.lucene.util.IOUtils;
|
import org.apache.lucene.util.IOUtils;
|
||||||
|
|
||||||
/** Holds core readers that are shared (unchanged) when SegmentReader is cloned or reopened */
|
/** Holds core readers that are shared (unchanged) when SegmentReader is cloned or reopened */
|
||||||
|
@ -68,26 +67,6 @@ final class SegmentCoreReaders {
|
||||||
*/
|
*/
|
||||||
final FieldInfos coreFieldInfos;
|
final FieldInfos coreFieldInfos;
|
||||||
|
|
||||||
// TODO: make a single thread local w/ a
|
|
||||||
// Thingy class holding fieldsReader, termVectorsReader,
|
|
||||||
// normsProducer
|
|
||||||
|
|
||||||
final CloseableThreadLocal<StoredFieldsReader> fieldsReaderLocal =
|
|
||||||
new CloseableThreadLocal<StoredFieldsReader>() {
|
|
||||||
@Override
|
|
||||||
protected StoredFieldsReader initialValue() {
|
|
||||||
return fieldsReaderOrig.clone();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
final CloseableThreadLocal<TermVectorsReader> termVectorsLocal =
|
|
||||||
new CloseableThreadLocal<TermVectorsReader>() {
|
|
||||||
@Override
|
|
||||||
protected TermVectorsReader initialValue() {
|
|
||||||
return (termVectorsReaderOrig == null) ? null : termVectorsReaderOrig.clone();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private final Set<IndexReader.ClosedListener> coreClosedListeners =
|
private final Set<IndexReader.ClosedListener> coreClosedListeners =
|
||||||
Collections.synchronizedSet(new LinkedHashSet<IndexReader.ClosedListener>());
|
Collections.synchronizedSet(new LinkedHashSet<IndexReader.ClosedListener>());
|
||||||
|
|
||||||
|
@ -190,8 +169,6 @@ final class SegmentCoreReaders {
|
||||||
if (ref.decrementAndGet() == 0) {
|
if (ref.decrementAndGet() == 0) {
|
||||||
try (Closeable finalizer = this::notifyCoreClosedListeners) {
|
try (Closeable finalizer = this::notifyCoreClosedListeners) {
|
||||||
IOUtils.close(
|
IOUtils.close(
|
||||||
termVectorsLocal,
|
|
||||||
fieldsReaderLocal,
|
|
||||||
fields,
|
fields,
|
||||||
termVectorsReaderOrig,
|
termVectorsReaderOrig,
|
||||||
fieldsReaderOrig,
|
fieldsReaderOrig,
|
||||||
|
|
|
@ -18,7 +18,6 @@ package org.apache.lucene.index;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
import org.apache.lucene.codecs.Codec;
|
import org.apache.lucene.codecs.Codec;
|
||||||
|
@ -245,38 +244,6 @@ public final class SegmentReader extends CodecReader {
|
||||||
return si.info.maxDoc();
|
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
|
@Override
|
||||||
public TermVectorsReader getTermVectorsReader() {
|
public TermVectorsReader getTermVectorsReader() {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
|
|
@ -24,14 +24,12 @@ import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.FutureTask;
|
import java.util.concurrent.FutureTask;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import org.apache.lucene.document.Document;
|
|
||||||
import org.apache.lucene.index.DirectoryReader;
|
import org.apache.lucene.index.DirectoryReader;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.IndexReaderContext;
|
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.LeafReaderContext;
|
||||||
import org.apache.lucene.index.QueryTimeout;
|
import org.apache.lucene.index.QueryTimeout;
|
||||||
import org.apache.lucene.index.ReaderUtil;
|
import org.apache.lucene.index.ReaderUtil;
|
||||||
import org.apache.lucene.index.StoredFieldVisitor;
|
|
||||||
import org.apache.lucene.index.StoredFields;
|
import org.apache.lucene.index.StoredFields;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.index.Terms;
|
import org.apache.lucene.index.Terms;
|
||||||
|
@ -379,39 +376,6 @@ public class IndexSearcher {
|
||||||
return reader;
|
return reader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sugar for <code>.getIndexReader().document(docID)</code>
|
|
||||||
*
|
|
||||||
* @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 <code>.getIndexReader().document(docID, fieldVisitor)</code>
|
|
||||||
*
|
|
||||||
* @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 <code>.getIndexReader().document(docID, fieldsToLoad)</code>
|
|
||||||
*
|
|
||||||
* @see IndexReader#document(int, Set)
|
|
||||||
* @deprecated Use {@link #storedFields()} to access fields for one or more documents
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public Document doc(int docID, Set<String> fieldsToLoad) throws IOException {
|
|
||||||
return reader.document(docID, fieldsToLoad);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link StoredFields} reader for the stored fields of this index.
|
* Returns a {@link StoredFields} reader for the stored fields of this index.
|
||||||
*
|
*
|
||||||
|
|
|
@ -66,11 +66,6 @@ public class TestSegmentToThreadMapping extends LuceneTestCase {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fields getTermVectors(int doc) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TermVectors termVectors() {
|
public TermVectors termVectors() {
|
||||||
return TermVectors.EMPTY;
|
return TermVectors.EMPTY;
|
||||||
|
@ -125,9 +120,6 @@ public class TestSegmentToThreadMapping extends LuceneTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void doClose() {}
|
protected void doClose() {}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void document(int doc, StoredFieldVisitor visitor) {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StoredFields storedFields() {
|
public StoredFields storedFields() {
|
||||||
return new StoredFields() {
|
return new StoredFields() {
|
||||||
|
|
|
@ -173,14 +173,6 @@ public class TermVectorLeafReader extends LeafReader {
|
||||||
@Override
|
@Override
|
||||||
public void checkIntegrity() throws IOException {}
|
public void checkIntegrity() throws IOException {}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fields getTermVectors(int docID) throws IOException {
|
|
||||||
if (docID != 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TermVectors termVectors() throws IOException {
|
public TermVectors termVectors() throws IOException {
|
||||||
return new TermVectors() {
|
return new TermVectors() {
|
||||||
|
@ -205,9 +197,6 @@ public class TermVectorLeafReader extends LeafReader {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void document(int docID, StoredFieldVisitor visitor) throws IOException {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StoredFields storedFields() throws IOException {
|
public StoredFields storedFields() throws IOException {
|
||||||
return new StoredFields() {
|
return new StoredFields() {
|
||||||
|
|
|
@ -1452,15 +1452,6 @@ public class UnifiedHighlighter {
|
||||||
super(in);
|
super(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fields getTermVectors(int docID) throws IOException {
|
|
||||||
if (docID != lastDocId) {
|
|
||||||
lastDocId = docID;
|
|
||||||
tvFields = in.getTermVectors(docID);
|
|
||||||
}
|
|
||||||
return tvFields;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TermVectors termVectors() throws IOException {
|
public TermVectors termVectors() throws IOException {
|
||||||
TermVectors orig = in.termVectors();
|
TermVectors orig = in.termVectors();
|
||||||
|
|
|
@ -1803,15 +1803,6 @@ public class MemoryIndex {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fields getTermVectors(int docID) {
|
|
||||||
if (docID == 0) {
|
|
||||||
return memoryFields;
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TermVectors termVectors() {
|
public TermVectors termVectors() {
|
||||||
return new TermVectors() {
|
return new TermVectors() {
|
||||||
|
@ -1838,12 +1829,6 @@ public class MemoryIndex {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void document(int docID, StoredFieldVisitor visitor) throws IOException {
|
|
||||||
if (DEBUG) System.err.println("MemoryIndexReader.document");
|
|
||||||
storedFields().document(docID, visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StoredFields storedFields() {
|
public StoredFields storedFields() {
|
||||||
return new StoredFields() {
|
return new StoredFields() {
|
||||||
|
|
|
@ -110,12 +110,6 @@ public class AssertingLeafReader extends FilterLeafReader {
|
||||||
return terms == null ? null : new AssertingTerms(terms);
|
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
|
@Override
|
||||||
public TermVectors termVectors() throws IOException {
|
public TermVectors termVectors() throws IOException {
|
||||||
return new AssertingTermVectors(super.termVectors());
|
return new AssertingTermVectors(super.termVectors());
|
||||||
|
|
|
@ -620,11 +620,6 @@ public abstract class BaseStoredFieldsFormatTestCase extends BaseIndexFileFormat
|
||||||
super(in);
|
super(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void document(int docID, StoredFieldVisitor visitor) throws IOException {
|
|
||||||
super.document(maxDoc() - 1 - docID, visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StoredFields storedFields() throws IOException {
|
public StoredFields storedFields() throws IOException {
|
||||||
StoredFields orig = in.storedFields();
|
StoredFields orig = in.storedFields();
|
||||||
|
|
|
@ -69,11 +69,6 @@ public final class FieldFilterLeafReader extends FilterLeafReader {
|
||||||
return fieldInfos;
|
return fieldInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fields getTermVectors(int docID) throws IOException {
|
|
||||||
return termVectors().get(docID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TermVectors termVectors() throws IOException {
|
public TermVectors termVectors() throws IOException {
|
||||||
TermVectors orig = super.termVectors();
|
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
|
@Override
|
||||||
public StoredFields storedFields() throws IOException {
|
public StoredFields storedFields() throws IOException {
|
||||||
StoredFields orig = super.storedFields();
|
StoredFields orig = super.storedFields();
|
||||||
|
@ -184,6 +174,7 @@ public final class FieldFilterLeafReader extends FilterLeafReader {
|
||||||
return sb.append(fields).append(')').toString();
|
return sb.append(fields).append(')').toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private class FieldFilterFields extends FilterFields {
|
private class FieldFilterFields extends FilterFields {
|
||||||
|
|
||||||
public FieldFilterFields(Fields in) {
|
public FieldFilterFields(Fields in) {
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
package org.apache.lucene.tests.index;
|
package org.apache.lucene.tests.index;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
|
||||||
import org.apache.lucene.codecs.DocValuesProducer;
|
import org.apache.lucene.codecs.DocValuesProducer;
|
||||||
import org.apache.lucene.codecs.FieldsProducer;
|
import org.apache.lucene.codecs.FieldsProducer;
|
||||||
import org.apache.lucene.codecs.NormsProducer;
|
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.DocValuesType;
|
||||||
import org.apache.lucene.index.FieldInfo;
|
import org.apache.lucene.index.FieldInfo;
|
||||||
import org.apache.lucene.index.FieldInfos;
|
import org.apache.lucene.index.FieldInfos;
|
||||||
import org.apache.lucene.index.Fields;
|
|
||||||
import org.apache.lucene.index.LeafMetaData;
|
import org.apache.lucene.index.LeafMetaData;
|
||||||
import org.apache.lucene.index.LeafReader;
|
import org.apache.lucene.index.LeafReader;
|
||||||
import org.apache.lucene.index.NumericDocValues;
|
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.SortedDocValues;
|
||||||
import org.apache.lucene.index.SortedNumericDocValues;
|
import org.apache.lucene.index.SortedNumericDocValues;
|
||||||
import org.apache.lucene.index.SortedSetDocValues;
|
import org.apache.lucene.index.SortedSetDocValues;
|
||||||
import org.apache.lucene.index.StoredFieldVisitor;
|
|
||||||
import org.apache.lucene.index.StoredFields;
|
import org.apache.lucene.index.StoredFields;
|
||||||
import org.apache.lucene.index.TermVectors;
|
import org.apache.lucene.index.TermVectors;
|
||||||
import org.apache.lucene.index.Terms;
|
import org.apache.lucene.index.Terms;
|
||||||
|
@ -204,16 +201,6 @@ class MergeReaderWrapper extends LeafReader {
|
||||||
in.checkIntegrity();
|
in.checkIntegrity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fields getTermVectors(int docID) throws IOException {
|
|
||||||
ensureOpen();
|
|
||||||
checkBounds(docID);
|
|
||||||
if (vectors == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return vectors.get(docID);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TermVectors termVectors() throws IOException {
|
public TermVectors termVectors() throws IOException {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
@ -250,13 +237,6 @@ class MergeReaderWrapper extends LeafReader {
|
||||||
return in.maxDoc();
|
return in.maxDoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void document(int docID, StoredFieldVisitor visitor) throws IOException {
|
|
||||||
ensureOpen();
|
|
||||||
checkBounds(docID);
|
|
||||||
store.document(docID, visitor);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StoredFields storedFields() throws IOException {
|
public StoredFields storedFields() throws IOException {
|
||||||
ensureOpen();
|
ensureOpen();
|
||||||
|
@ -278,10 +258,6 @@ class MergeReaderWrapper extends LeafReader {
|
||||||
return in.getReaderCacheHelper();
|
return in.getReaderCacheHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkBounds(int docID) {
|
|
||||||
Objects.checkIndex(docID, maxDoc());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "MergeReaderWrapper(" + in + ")";
|
return "MergeReaderWrapper(" + in + ")";
|
||||||
|
|
|
@ -47,11 +47,6 @@ public class MismatchedLeafReader extends FilterLeafReader {
|
||||||
return shuffled;
|
return shuffled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void document(int docID, StoredFieldVisitor visitor) throws IOException {
|
|
||||||
in.document(docID, new MismatchedVisitor(visitor));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StoredFields storedFields() throws IOException {
|
public StoredFields storedFields() throws IOException {
|
||||||
final StoredFields inStoredFields = in.storedFields();
|
final StoredFields inStoredFields = in.storedFields();
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import org.apache.lucene.index.BinaryDocValues;
|
import org.apache.lucene.index.BinaryDocValues;
|
||||||
import org.apache.lucene.index.FieldInfos;
|
import org.apache.lucene.index.FieldInfos;
|
||||||
import org.apache.lucene.index.Fields;
|
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.index.LeafMetaData;
|
import org.apache.lucene.index.LeafMetaData;
|
||||||
import org.apache.lucene.index.LeafReader;
|
import org.apache.lucene.index.LeafReader;
|
||||||
|
@ -255,11 +254,6 @@ public class QueryUtils {
|
||||||
@Override
|
@Override
|
||||||
public void checkIntegrity() throws IOException {}
|
public void checkIntegrity() throws IOException {}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Fields getTermVectors(int docID) throws IOException {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TermVectors termVectors() {
|
public TermVectors termVectors() {
|
||||||
return TermVectors.EMPTY;
|
return TermVectors.EMPTY;
|
||||||
|
@ -275,9 +269,6 @@ public class QueryUtils {
|
||||||
return maxDoc;
|
return maxDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void document(int docID, StoredFieldVisitor visitor) throws IOException {}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StoredFields storedFields() {
|
public StoredFields storedFields() {
|
||||||
return new StoredFields() {
|
return new StoredFields() {
|
||||||
|
|
Loading…
Reference in New Issue