Index: lucene/CHANGES.txt =================================================================== --- lucene/CHANGES.txt (revision 1212509) +++ lucene/CHANGES.txt (working copy) @@ -26,6 +26,22 @@ prevents this as best as it can by throwing AlreadyClosedException also on clones. (Uwe Schindler, Robert Muir) +API Changes + +* LUCENE-3606: IndexReader will be made read-only in Lucene 4.0, so all + methods allowing to delete or undelete documents using IndexReader were + deprecated; you should use IndexWriter now. Consequently + IndexReader.commit() and all open(), openIfChanged(), clone() methods + taking readOnly booleans (or IndexDeletionPolicy instances) were + deprecated. IndexReader.setNorm() is superfluous and was deprecated. + If you have to change per-document boost use CustomScoreQuery. + If you want to dynamically change norms (boost *and* length norm) at + query time, wrap your IndexReader using FilterIndexReader, overriding + FilterIndexReader.norms(). To persist the changes on disk, copy the + FilteredIndexReader to a new index using IndexWriter.addIndexes(). + In Lucene 4.0, SimilarityProvider will allow you to customize scoring + using external norms, too. (Uwe Schindler, Robert Muir) + New Features * LUCENE-3593: Added a FieldValueFilter that accepts all documents that either Index: lucene/contrib/CHANGES.txt =================================================================== --- lucene/contrib/CHANGES.txt (revision 1212509) +++ lucene/contrib/CHANGES.txt (working copy) @@ -15,6 +15,11 @@ * LUCENE-3596: DirectoryTaxonomyWriter.openIndexWriter() now takes an openIndexWriter parameter rather than just an open-mode. (Doron Cohen) +* LUCENE-3606: FieldNormModifier was deprecated, because IndexReader's + setNorm() was deprecated. Furthermore, this class is broken, as it does + not take position overlaps into account while recalculating norms. + (Uwe Schindler, Robert Muir) + Bug Fixes * LUCENE-3600: BlockJoinQuery now supports parent docs that have no Index: lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java =================================================================== --- lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (revision 1212509) +++ lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (working copy) @@ -1131,7 +1131,8 @@ System.arraycopy(norms, 0, bytes, offset, norms.length); } - @Override + /** {@inheritDoc} */ + @Deprecated @Override protected void doSetNorm(int doc, String fieldName, byte value) { throw new UnsupportedOperationException(); } @@ -1167,17 +1168,20 @@ return false; } - @Override + /** {@inheritDoc} */ + @Deprecated @Override protected void doDelete(int docNum) { throw new UnsupportedOperationException(); } - @Override + /** {@inheritDoc} */ + @Deprecated @Override protected void doUndeleteAll() { throw new UnsupportedOperationException(); } - @Override + /** {@inheritDoc} */ + @Deprecated @Override protected void doCommit(Map commitUserData) { if (DEBUG) System.err.println("MemoryIndexReader.doCommit"); } Index: lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java =================================================================== --- lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java (revision 1212509) +++ lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java (working copy) @@ -35,8 +35,10 @@ *

* NOTE: This will overwrite any length normalization or field/document boosts. *

- * + * @deprecated This class is broken, as it does not correctly take position + * overlaps into account. */ +@Deprecated public class FieldNormModifier { /** Index: lucene/src/java/org/apache/lucene/index/DirectoryReader.java =================================================================== --- lucene/src/java/org/apache/lucene/index/DirectoryReader.java (revision 1212509) +++ lucene/src/java/org/apache/lucene/index/DirectoryReader.java (working copy) @@ -360,7 +360,8 @@ } } - @Override + /** {@inheritDoc} */ + @Override @Deprecated public final synchronized IndexReader clone(boolean openReadOnly) throws CorruptIndexException, IOException { // doOpenIfChanged calls ensureOpen DirectoryReader newReader = doOpenIfChanged((SegmentInfos) segmentInfos.clone(), true, openReadOnly); @@ -391,7 +392,8 @@ return doOpenIfChanged(readOnly, null); } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected final IndexReader doOpenIfChanged(boolean openReadOnly) throws CorruptIndexException, IOException { return doOpenIfChanged(openReadOnly, null); } @@ -547,6 +549,7 @@ subReaders[i].getTermFreqVector(docNumber - starts[i], mapper); } + /** {@inheritDoc} */ @Deprecated @Override public boolean isOptimized() { @@ -596,7 +599,8 @@ return hasDeletions; } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doDelete(int n) throws CorruptIndexException, IOException { numDocs = -1; // invalidate cache int i = readerIndex(n); // find segment num @@ -604,7 +608,8 @@ hasDeletions = true; } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doUndeleteAll() throws CorruptIndexException, IOException { for (int i = 0; i < subReaders.length; i++) subReaders[i].undeleteAll(); @@ -679,7 +684,8 @@ } } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doSetNorm(int n, String field, byte value) throws CorruptIndexException, IOException { synchronized (normsCache) { @@ -763,8 +769,9 @@ * if another writer has this index open (write.lock could not be * obtained) * @throws IOException if there is a low-level IO error + * @deprecated */ - @Override + @Override @Deprecated protected void acquireWriteLock() throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException { if (readOnly) { @@ -805,8 +812,9 @@ * semantics). * * @throws IOException if there is a low-level IO error + * @deprecated */ - @Override + @Override @Deprecated protected void doCommit(Map commitUserData) throws IOException { if (hasChanges) { segmentInfos.setUserData(commitUserData); Index: lucene/src/java/org/apache/lucene/index/FilterIndexReader.java =================================================================== --- lucene/src/java/org/apache/lucene/index/FilterIndexReader.java (revision 1212509) +++ lucene/src/java/org/apache/lucene/index/FilterIndexReader.java (working copy) @@ -197,7 +197,8 @@ return in.hasDeletions(); } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doUndeleteAll() throws CorruptIndexException, IOException {in.undeleteAll();} @Override @@ -218,7 +219,8 @@ in.norms(f, bytes, offset); } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doSetNorm(int d, String f, byte b) throws CorruptIndexException, IOException { in.setNorm(d, f, b); } @@ -259,10 +261,12 @@ return in.termPositions(); } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doDelete(int n) throws CorruptIndexException, IOException { in.deleteDocument(n); } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doCommit(Map commitUserData) throws IOException { in.commit(commitUserData); } Index: lucene/src/java/org/apache/lucene/index/IndexReader.java =================================================================== --- lucene/src/java/org/apache/lucene/index/IndexReader.java (revision 1212509) +++ lucene/src/java/org/apache/lucene/index/IndexReader.java (working copy) @@ -305,7 +305,7 @@ * @throws IOException if there is a low-level IO error */ public static IndexReader open(final Directory directory) throws CorruptIndexException, IOException { - return open(directory, null, null, true, DEFAULT_TERMS_INDEX_DIVISOR); + return DirectoryReader.open(directory, null, null, true, DEFAULT_TERMS_INDEX_DIVISOR); } /** Returns an IndexReader reading the index in the given @@ -317,9 +317,12 @@ * @param readOnly true if no changes (deletions, norms) will be made with this IndexReader * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link #open(Directory)} instead */ + @Deprecated public static IndexReader open(final Directory directory, boolean readOnly) throws CorruptIndexException, IOException { - return open(directory, null, null, readOnly, DEFAULT_TERMS_INDEX_DIVISOR); + return DirectoryReader.open(directory, null, null, readOnly, DEFAULT_TERMS_INDEX_DIVISOR); } /** @@ -346,6 +349,16 @@ } /** Expert: returns an IndexReader reading the index in the given + * {@link IndexCommit}. + * @param commit the commit point to open + * @throws CorruptIndexException if the index is corrupt + * @throws IOException if there is a low-level IO error + */ + public static IndexReader open(final IndexCommit commit) throws CorruptIndexException, IOException { + return DirectoryReader.open(commit.getDirectory(), null, commit, true, DEFAULT_TERMS_INDEX_DIVISOR); + } + + /** Expert: returns an IndexReader reading the index in the given * {@link IndexCommit}. You should pass readOnly=true, since it * gives much better concurrent performance, unless you * intend to do write operations (delete documents or @@ -354,9 +367,12 @@ * @param readOnly true if no changes (deletions, norms) will be made with this IndexReader * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link #open(IndexCommit)} instead */ + @Deprecated public static IndexReader open(final IndexCommit commit, boolean readOnly) throws CorruptIndexException, IOException { - return open(commit.getDirectory(), null, commit, readOnly, DEFAULT_TERMS_INDEX_DIVISOR); + return DirectoryReader.open(commit.getDirectory(), null, commit, readOnly, DEFAULT_TERMS_INDEX_DIVISOR); } /** Expert: returns an IndexReader reading the index in @@ -372,9 +388,12 @@ * @param readOnly true if no changes (deletions, norms) will be made with this IndexReader * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link #open(Directory)} instead */ + @Deprecated public static IndexReader open(final Directory directory, IndexDeletionPolicy deletionPolicy, boolean readOnly) throws CorruptIndexException, IOException { - return open(directory, deletionPolicy, null, readOnly, DEFAULT_TERMS_INDEX_DIVISOR); + return DirectoryReader.open(directory, deletionPolicy, null, readOnly, DEFAULT_TERMS_INDEX_DIVISOR); } /** Expert: returns an IndexReader reading the index in @@ -400,9 +419,12 @@ * to -1 to skip loading the terms index entirely. * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link #open(Directory,int)} instead */ + @Deprecated public static IndexReader open(final Directory directory, IndexDeletionPolicy deletionPolicy, boolean readOnly, int termInfosIndexDivisor) throws CorruptIndexException, IOException { - return open(directory, deletionPolicy, null, readOnly, termInfosIndexDivisor); + return DirectoryReader.open(directory, deletionPolicy, null, readOnly, termInfosIndexDivisor); } /** Expert: returns an IndexReader reading the index in @@ -420,9 +442,12 @@ * @param readOnly true if no changes (deletions, norms) will be made with this IndexReader * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link #open(IndexCommit)} instead */ + @Deprecated public static IndexReader open(final IndexCommit commit, IndexDeletionPolicy deletionPolicy, boolean readOnly) throws CorruptIndexException, IOException { - return open(commit.getDirectory(), deletionPolicy, commit, readOnly, DEFAULT_TERMS_INDEX_DIVISOR); + return DirectoryReader.open(commit.getDirectory(), deletionPolicy, commit, readOnly, DEFAULT_TERMS_INDEX_DIVISOR); } /** Expert: returns an IndexReader reading the index in @@ -453,15 +478,54 @@ * * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link #open(IndexCommit,int)} instead */ + @Deprecated public static IndexReader open(final IndexCommit commit, IndexDeletionPolicy deletionPolicy, boolean readOnly, int termInfosIndexDivisor) throws CorruptIndexException, IOException { - return open(commit.getDirectory(), deletionPolicy, commit, readOnly, termInfosIndexDivisor); + return DirectoryReader.open(commit.getDirectory(), deletionPolicy, commit, readOnly, termInfosIndexDivisor); } - private static IndexReader open(final Directory directory, final IndexDeletionPolicy deletionPolicy, final IndexCommit commit, final boolean readOnly, int termInfosIndexDivisor) throws CorruptIndexException, IOException { - return DirectoryReader.open(directory, deletionPolicy, commit, readOnly, termInfosIndexDivisor); + /** Expert: Returns a IndexReader reading the index in the given + * Director and given termInfosIndexDivisor + * @param directory the index directory + * @param termInfosIndexDivisor Subsamples which indexed + * terms are loaded into RAM. This has the same effect as {@link + * IndexWriterConfig#setTermIndexInterval} except that setting + * must be done at indexing time while this setting can be + * set per reader. When set to N, then one in every + * N*termIndexInterval terms in the index is loaded into + * memory. By setting this to a value > 1 you can reduce + * memory usage, at the expense of higher latency when + * loading a TermInfo. The default value is 1. Set this + * to -1 to skip loading the terms index entirely. + * @throws CorruptIndexException if the index is corrupt + * @throws IOException if there is a low-level IO error + */ + public static IndexReader open(final Directory directory, int termInfosIndexDivisor) throws CorruptIndexException, IOException { + return DirectoryReader.open(directory, null, null, true, termInfosIndexDivisor); } + /** Expert: returns an IndexReader reading the index in the given + * {@link IndexCommit} and termInfosIndexDivisor. + * @param commit the commit point to open + * @param termInfosIndexDivisor Subsamples which indexed + * terms are loaded into RAM. This has the same effect as {@link + * IndexWriterConfig#setTermIndexInterval} except that setting + * must be done at indexing time while this setting can be + * set per reader. When set to N, then one in every + * N*termIndexInterval terms in the index is loaded into + * memory. By setting this to a value > 1 you can reduce + * memory usage, at the expense of higher latency when + * loading a TermInfo. The default value is 1. Set this + * to -1 to skip loading the terms index entirely. + * @throws CorruptIndexException if the index is corrupt + * @throws IOException if there is a low-level IO error + */ + public static IndexReader open(final IndexCommit commit, int termInfosIndexDivisor) throws CorruptIndexException, IOException { + return DirectoryReader.open(commit.getDirectory(), null, commit, true, termInfosIndexDivisor); + } + /** * If the index has changed since the provided reader was * opened, open and return a new reader; else, return @@ -513,7 +577,10 @@ * null. * * @see #openIfChanged(IndexReader) + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link #openIfChanged(IndexReader)} instead */ + @Deprecated public static IndexReader openIfChanged(IndexReader oldReader, boolean readOnly) throws IOException { if (oldReader.hasNewReopenAPI2) { final IndexReader newReader = oldReader.doOpenIfChanged(readOnly); @@ -673,7 +740,7 @@ * * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error - * @deprecated Use IndexReader#openIfChanged(IndexReader) instead + * @deprecated Use {@link #openIfChanged(IndexReader)} instead */ @Deprecated public IndexReader reopen() throws CorruptIndexException, IOException { @@ -689,8 +756,9 @@ * readOnly of the original reader. If the index is * unchanged but readOnly is different then a new reader * will be returned. - * @deprecated Use - * IndexReader#openIfChanged(IndexReader,boolean) instead */ + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link #openIfChanged(IndexReader)} instead + */ @Deprecated public IndexReader reopen(boolean openReadOnly) throws CorruptIndexException, IOException { final IndexReader newReader = IndexReader.openIfChanged(this, openReadOnly); @@ -707,7 +775,7 @@ * already on, and this reader is already readOnly, then * this same instance is returned; if it is not already * readOnly, a readOnly clone is returned. - * @deprecated Use IndexReader#openIfChanged(IndexReader,IndexCommit) instead + * @deprecated Use {@link #openIfChanged(IndexReader,IndexCommit)} instead */ @Deprecated public IndexReader reopen(IndexCommit commit) throws CorruptIndexException, IOException { @@ -786,7 +854,7 @@ * @throws IOException * * @lucene.experimental - * @deprecated Use IndexReader#openIfChanged(IndexReader,IndexReader,boolean) instead + * @deprecated Use {@link #openIfChanged(IndexReader,IndexWriter,boolean)} instead */ @Deprecated public IndexReader reopen(IndexWriter writer, boolean applyAllDeletes) throws CorruptIndexException, IOException { @@ -813,7 +881,10 @@ * else, return {@code null}. * * @see #openIfChanged(IndexReader, boolean) + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link #doOpenIfChanged()} instead */ + @Deprecated protected IndexReader doOpenIfChanged(boolean openReadOnly) throws CorruptIndexException, IOException { throw new UnsupportedOperationException("This reader does not support reopen()."); } @@ -865,7 +936,10 @@ * reader cannot open a writeable reader. * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link #clone()} instead. */ + @Deprecated public synchronized IndexReader clone(boolean openReadOnly) throws CorruptIndexException, IOException { throw new UnsupportedOperationException("This reader does not implement clone()"); } @@ -1196,7 +1270,10 @@ * be obtained) * @throws IOException if there is a low-level IO error * @throws IllegalStateException if the field does not index norms + * @deprecated Write support will be removed in Lucene 4.0. + * There will be no replacement for this method. */ + @Deprecated public final synchronized void setNorm(int doc, String field, byte value) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException { ensureOpen(); @@ -1205,7 +1282,11 @@ doSetNorm(doc, field, value); } - /** Implements setNorm in subclass.*/ + /** Implements setNorm in subclass. + * @deprecated Write support will be removed in Lucene 4.0. + * There will be no replacement for this method. + */ + @Deprecated protected abstract void doSetNorm(int doc, String field, byte value) throws CorruptIndexException, IOException; @@ -1222,9 +1303,8 @@ * has this index open (write.lock could not * be obtained) * @throws IOException if there is a low-level IO error - * @deprecated Use {@link #setNorm(int, String, byte)} instead, encoding the - * float to byte with your Similarity's {@link Similarity#encodeNormValue(float)}. - * This method will be removed in Lucene 4.0 + * @deprecated Write support will be removed in Lucene 4.0. + * There will be no replacement for this method. */ @Deprecated public final void setNorm(int doc, String field, float value) @@ -1332,7 +1412,10 @@ * has this index open (write.lock could not * be obtained) * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link IndexWriter#deleteDocuments(Term)} instead */ + @Deprecated public final synchronized void deleteDocument(int docNum) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException { ensureOpen(); acquireWriteLock(); @@ -1343,7 +1426,10 @@ /** Implements deletion of the document numbered docNum. * Applications should call {@link #deleteDocument(int)} or {@link #deleteDocuments(Term)}. + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link IndexWriter#deleteDocuments(Term)} instead */ + @Deprecated protected abstract void doDelete(int docNum) throws CorruptIndexException, IOException; @@ -1363,7 +1449,10 @@ * has this index open (write.lock could not * be obtained) * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. + * Use {@link IndexWriter#deleteDocuments(Term)} instead */ + @Deprecated public final int deleteDocuments(Term term) throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException { ensureOpen(); TermDocs docs = termDocs(term); @@ -1398,7 +1487,10 @@ * be obtained) * @throws CorruptIndexException if the index is corrupt * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. + * There will be no replacement for this method. */ + @Deprecated public final synchronized void undeleteAll() throws StaleReaderException, CorruptIndexException, LockObtainFailedException, IOException { ensureOpen(); acquireWriteLock(); @@ -1406,11 +1498,18 @@ doUndeleteAll(); } - /** Implements actual undeleteAll() in subclass. */ + /** Implements actual undeleteAll() in subclass. + * @deprecated Write support will be removed in Lucene 4.0. + * There will be no replacement for this method. + */ + @Deprecated protected abstract void doUndeleteAll() throws CorruptIndexException, IOException; /** Does nothing by default. Subclasses that require a write lock for - * index modifications must implement this method. */ + * index modifications must implement this method. + * @deprecated Write support will be removed in Lucene 4.0. + */ + @Deprecated protected synchronized void acquireWriteLock() throws IOException { /* NOOP */ } @@ -1418,7 +1517,9 @@ /** * * @throws IOException + * @deprecated Write support will be removed in Lucene 4.0. */ + @Deprecated public final synchronized void flush() throws IOException { ensureOpen(); commit(); @@ -1430,7 +1531,9 @@ * and retrievable by {@link * IndexReader#getCommitUserData}. * @throws IOException + * @deprecated Write support will be removed in Lucene 4.0. */ + @Deprecated public final synchronized void flush(Map commitUserData) throws IOException { ensureOpen(); commit(commitUserData); @@ -1444,7 +1547,9 @@ * changes will have been committed to the index * (transactional semantics). * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. */ + @Deprecated protected final synchronized void commit() throws IOException { commit(null); } @@ -1457,14 +1562,19 @@ * changes will have been committed to the index * (transactional semantics). * @throws IOException if there is a low-level IO error + * @deprecated Write support will be removed in Lucene 4.0. */ + @Deprecated public final synchronized void commit(Map commitUserData) throws IOException { // Don't call ensureOpen since we commit() on close doCommit(commitUserData); hasChanges = false; } - /** Implements commit. */ + /** Implements commit. + * @deprecated Write support will be removed in Lucene 4.0. + */ + @Deprecated protected abstract void doCommit(Map commitUserData) throws IOException; /** Index: lucene/src/java/org/apache/lucene/index/MultiReader.java =================================================================== --- lucene/src/java/org/apache/lucene/index/MultiReader.java (revision 1212509) +++ lucene/src/java/org/apache/lucene/index/MultiReader.java (working copy) @@ -220,6 +220,7 @@ subReaders[i].getTermFreqVector(docNumber - starts[i], mapper); } + /** {@inheritDoc} */ @Deprecated @Override public boolean isOptimized() { @@ -268,7 +269,8 @@ return hasDeletions; } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doDelete(int n) throws CorruptIndexException, IOException { numDocs = -1; // invalidate cache int i = readerIndex(n); // find segment num @@ -276,7 +278,8 @@ hasDeletions = true; } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doUndeleteAll() throws CorruptIndexException, IOException { for (int i = 0; i < subReaders.length; i++) subReaders[i].undeleteAll(); @@ -333,7 +336,8 @@ } } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doSetNorm(int n, String field, byte value) throws CorruptIndexException, IOException { synchronized (normsCache) { @@ -407,7 +411,8 @@ } } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doCommit(Map commitUserData) throws IOException { for (int i = 0; i < subReaders.length; i++) subReaders[i].commit(commitUserData); Index: lucene/src/java/org/apache/lucene/index/ParallelReader.java =================================================================== --- lucene/src/java/org/apache/lucene/index/ParallelReader.java (revision 1212509) +++ lucene/src/java/org/apache/lucene/index/ParallelReader.java (working copy) @@ -267,8 +267,8 @@ return false; } - // delete in all readers - @Override + /** {@inheritDoc} */ + @Deprecated @Override protected void doDelete(int n) throws CorruptIndexException, IOException { for (final IndexReader reader : readers) { reader.deleteDocument(n); @@ -276,8 +276,8 @@ hasDeletions = true; } - // undeleteAll in all readers - @Override + /** {@inheritDoc} */ + @Deprecated @Override protected void doUndeleteAll() throws CorruptIndexException, IOException { for (final IndexReader reader : readers) { reader.undeleteAll(); @@ -381,7 +381,8 @@ reader.norms(field, result, offset); } - @Override + /** {@inheritDoc} */ + @Deprecated @Override protected void doSetNorm(int n, String field, byte value) throws CorruptIndexException, IOException { IndexReader reader = fieldToReader.get(field); @@ -469,7 +470,8 @@ return readers.toArray(new IndexReader[readers.size()]); } - @Override + /** {@inheritDoc} */ + @Deprecated @Override protected void doCommit(Map commitUserData) throws IOException { for (final IndexReader reader : readers) reader.commit(commitUserData); Index: lucene/src/java/org/apache/lucene/index/SegmentReader.java =================================================================== --- lucene/src/java/org/apache/lucene/index/SegmentReader.java (revision 1212509) +++ lucene/src/java/org/apache/lucene/index/SegmentReader.java (working copy) @@ -44,7 +44,7 @@ * @lucene.experimental */ public class SegmentReader extends IndexReader implements Cloneable { - protected boolean readOnly; + @Deprecated protected boolean readOnly; private SegmentInfo si; private int readBufferSize; @@ -170,7 +170,9 @@ * Clones the norm bytes. May be overridden by subclasses. New and experimental. * @param bytes Byte array to clone * @return New BitVector + * @deprecated */ + @Deprecated protected byte[] cloneNormBytes(byte[] bytes) { byte[] cloneBytes = new byte[bytes.length]; System.arraycopy(bytes, 0, cloneBytes, 0, bytes.length); @@ -181,7 +183,9 @@ * Clones the deleteDocs BitVector. May be overridden by subclasses. New and experimental. * @param bv BitVector to clone * @return New BitVector + * @deprecated */ + @Deprecated protected BitVector cloneDeletedDocs(BitVector bv) { ensureOpen(); return (BitVector)bv.clone(); @@ -196,7 +200,8 @@ } } - @Override + /** {@inheritDoc} */ + @Override @Deprecated public final synchronized IndexReader clone(boolean openReadOnly) throws CorruptIndexException, IOException { return reopenSegment(si, true, openReadOnly); } @@ -207,7 +212,8 @@ return reopenSegment(si, false, readOnly); } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected synchronized IndexReader doOpenIfChanged(boolean openReadOnly) throws CorruptIndexException, IOException { return reopenSegment(si, false, openReadOnly); @@ -307,7 +313,8 @@ return clone; } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doCommit(Map commitUserData) throws IOException { if (hasChanges) { startCommit(); @@ -410,7 +417,8 @@ return si.hasSeparateNorms(); } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doDelete(int docNum) { if (deletedDocs == null) { deletedDocs = new BitVector(maxDoc()); @@ -431,7 +439,8 @@ } } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doUndeleteAll() { deletedDocsDirty = false; if (deletedDocs != null) { @@ -599,7 +608,8 @@ return norm.bytes(); } - @Override + /** {@inheritDoc} */ + @Override @Deprecated protected void doSetNorm(int doc, String field, byte value) throws IOException { SegmentNorms norm = norms.get(field);