You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2011/12/09 18:44:49 UTC

svn commit: r1212539 - in /lucene/dev/branches/branch_3x/lucene: ./ contrib/ contrib/memory/src/java/org/apache/lucene/index/memory/ contrib/misc/src/java/org/apache/lucene/index/ src/java/org/apache/lucene/index/

Author: uschindler
Date: Fri Dec  9 17:44:47 2011
New Revision: 1212539

URL: http://svn.apache.org/viewvc?rev=1212539&view=rev
Log:
LUCENE-3606: Add deprecations to 3.x

Modified:
    lucene/dev/branches/branch_3x/lucene/CHANGES.txt
    lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt
    lucene/dev/branches/branch_3x/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
    lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/DirectoryReader.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexReader.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/MultiReader.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/ParallelReader.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java

Modified: lucene/dev/branches/branch_3x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/CHANGES.txt?rev=1212539&r1=1212538&r2=1212539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/lucene/CHANGES.txt Fri Dec  9 17:44:47 2011
@@ -26,6 +26,22 @@ Security fixes
   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

Modified: lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt?rev=1212539&r1=1212538&r2=1212539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/CHANGES.txt Fri Dec  9 17:44:47 2011
@@ -15,6 +15,11 @@ API Changes
 * 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

Modified: lucene/dev/branches/branch_3x/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?rev=1212539&r1=1212538&r2=1212539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java Fri Dec  9 17:44:47 2011
@@ -1131,7 +1131,8 @@ public class MemoryIndex implements Seri
       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 @@ public class MemoryIndex implements Seri
       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<String,String> commitUserData) {
       if (DEBUG) System.err.println("MemoryIndexReader.doCommit");
     }

Modified: lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java?rev=1212539&r1=1212538&r2=1212539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java Fri Dec  9 17:44:47 2011
@@ -35,8 +35,10 @@ import org.apache.lucene.util.StringHelp
  * <p>
  * NOTE: This will overwrite any length normalization or field/document boosts.
  * </p>
- *
+ * @deprecated This class is broken, as it does not correctly take position 
+ * overlaps into account.
  */
+@Deprecated
 public class FieldNormModifier {
 
   /**

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/DirectoryReader.java?rev=1212539&r1=1212538&r2=1212539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/DirectoryReader.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/DirectoryReader.java Fri Dec  9 17:44:47 2011
@@ -360,7 +360,8 @@ class DirectoryReader extends IndexReade
     }
   }
 
-  @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 @@ class DirectoryReader extends IndexReade
     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 @@ class DirectoryReader extends IndexReade
     subReaders[i].getTermFreqVector(docNumber - starts[i], mapper);
   }
 
+  /** {@inheritDoc} */
   @Deprecated
   @Override
   public boolean isOptimized() {
@@ -596,7 +599,8 @@ class DirectoryReader extends IndexReade
     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 @@ class DirectoryReader extends IndexReade
     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 @@ class DirectoryReader extends IndexReade
     }
   }
 
-  @Override
+  /** {@inheritDoc} */
+  @Override @Deprecated
   protected void doSetNorm(int n, String field, byte value)
     throws CorruptIndexException, IOException {
     synchronized (normsCache) {
@@ -763,8 +769,9 @@ class DirectoryReader extends IndexReade
    *                               if another writer has this index open (<code>write.lock</code> 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 @@ class DirectoryReader extends IndexReade
    * semantics).
    *
    * @throws IOException if there is a low-level IO error
+   * @deprecated
    */
-  @Override
+  @Override @Deprecated
   protected void doCommit(Map<String,String> commitUserData) throws IOException {
     if (hasChanges) {
       segmentInfos.setUserData(commitUserData);

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java?rev=1212539&r1=1212538&r2=1212539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java Fri Dec  9 17:44:47 2011
@@ -197,7 +197,8 @@ public class FilterIndexReader extends I
     return in.hasDeletions();
   }
 
-  @Override
+  /** {@inheritDoc} */
+  @Override @Deprecated
   protected void doUndeleteAll() throws CorruptIndexException, IOException {in.undeleteAll();}
 
   @Override
@@ -218,7 +219,8 @@ public class FilterIndexReader extends I
     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 @@ public class FilterIndexReader extends I
     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<String,String> commitUserData) throws IOException {
     in.commit(commitUserData);
   }

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexReader.java?rev=1212539&r1=1212538&r2=1212539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexReader.java Fri Dec  9 17:44:47 2011
@@ -305,7 +305,7 @@ public abstract class IndexReader implem
    * @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 @@ public abstract class IndexReader implem
    * @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 @@ public abstract class IndexReader implem
   }
 
   /** 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 @@ public abstract class IndexReader implem
    * @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 @@ public abstract class IndexReader implem
    * @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 @@ public abstract class IndexReader implem
    *  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 @@ public abstract class IndexReader implem
    * @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,13 +478,52 @@ public abstract class IndexReader implem
    *  
    * @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);
   }
 
   /**
@@ -513,7 +577,10 @@ public abstract class IndexReader implem
    * 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 @@ public abstract class IndexReader implem
    * 
    * @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 @@ public abstract class IndexReader implem
    *  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 @@ public abstract class IndexReader implem
    *  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 @@ public abstract class IndexReader implem
    * @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 @@ public abstract class IndexReader implem
    * 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 @@ public abstract class IndexReader implem
    * 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 @@ public abstract class IndexReader implem
    *  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 @@ public abstract class IndexReader implem
     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 @@ public abstract class IndexReader implem
    *  has this index open (<code>write.lock</code> 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 @@ public abstract class IndexReader implem
    *  has this index open (<code>write.lock</code> 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 @@ public abstract class IndexReader implem
 
   /** Implements deletion of the document numbered <code>docNum</code>.
    * 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 @@ public abstract class IndexReader implem
    *  has this index open (<code>write.lock</code> 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 @@ public abstract class IndexReader implem
    *  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 @@ public abstract class IndexReader implem
     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 @@ public abstract class IndexReader implem
   /**
    * 
    * @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 @@ public abstract class IndexReader implem
    *  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<String, String> commitUserData) throws IOException {
     ensureOpen();
     commit(commitUserData);
@@ -1444,7 +1547,9 @@ public abstract class IndexReader implem
    * 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 @@ public abstract class IndexReader implem
    * 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<String, String> 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<String, String> commitUserData) throws IOException;
 
   /**

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/MultiReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/MultiReader.java?rev=1212539&r1=1212538&r2=1212539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/MultiReader.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/MultiReader.java Fri Dec  9 17:44:47 2011
@@ -220,6 +220,7 @@ public class MultiReader extends IndexRe
     subReaders[i].getTermFreqVector(docNumber - starts[i], mapper);
   }
 
+  /** {@inheritDoc} */
   @Deprecated
   @Override
   public boolean isOptimized() {
@@ -268,7 +269,8 @@ public class MultiReader extends IndexRe
     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 @@ public class MultiReader extends IndexRe
     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 @@ public class MultiReader extends IndexRe
     }
   }
 
-  @Override
+  /** {@inheritDoc} */
+  @Override @Deprecated
   protected void doSetNorm(int n, String field, byte value)
     throws CorruptIndexException, IOException {
     synchronized (normsCache) {
@@ -407,7 +411,8 @@ public class MultiReader extends IndexRe
     }
   }
 
-  @Override
+  /** {@inheritDoc} */
+  @Override @Deprecated
   protected void doCommit(Map<String,String> commitUserData) throws IOException {
     for (int i = 0; i < subReaders.length; i++)
       subReaders[i].commit(commitUserData);

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/ParallelReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/ParallelReader.java?rev=1212539&r1=1212538&r2=1212539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/ParallelReader.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/ParallelReader.java Fri Dec  9 17:44:47 2011
@@ -267,8 +267,8 @@ public class ParallelReader extends Inde
     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 @@ public class ParallelReader extends Inde
     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 @@ public class ParallelReader extends Inde
       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 @@ public class ParallelReader extends Inde
     return readers.toArray(new IndexReader[readers.size()]);
   }
 
-  @Override
+  /** {@inheritDoc} */
+  @Deprecated @Override
   protected void doCommit(Map<String,String> commitUserData) throws IOException {
     for (final IndexReader reader : readers)
       reader.commit(commitUserData);

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java?rev=1212539&r1=1212538&r2=1212539&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/SegmentReader.java Fri Dec  9 17:44:47 2011
@@ -44,7 +44,7 @@ import org.apache.lucene.util.StringHelp
  * @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 @@ public class SegmentReader extends Index
    * 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 @@ public class SegmentReader extends Index
    * 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 @@ public class SegmentReader extends Index
     }
   }
 
-  @Override
+  /** {@inheritDoc} */
+  @Override @Deprecated
   public final synchronized IndexReader clone(boolean openReadOnly) throws CorruptIndexException, IOException {
     return reopenSegment(si, true, openReadOnly);
   }
@@ -207,7 +212,8 @@ public class SegmentReader extends Index
     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 @@ public class SegmentReader extends Index
     return clone;
   }
 
-  @Override
+  /** {@inheritDoc} */
+  @Override @Deprecated
   protected void doCommit(Map<String,String> commitUserData) throws IOException {
     if (hasChanges) {
       startCommit();
@@ -410,7 +417,8 @@ public class SegmentReader extends Index
     return si.hasSeparateNorms();
   }
 
-  @Override
+  /** {@inheritDoc} */
+  @Override @Deprecated
   protected void doDelete(int docNum) {
     if (deletedDocs == null) {
       deletedDocs = new BitVector(maxDoc());
@@ -431,7 +439,8 @@ public class SegmentReader extends Index
     }
   }
 
-  @Override
+  /** {@inheritDoc} */
+  @Override @Deprecated
   protected void doUndeleteAll() {
     deletedDocsDirty = false;
     if (deletedDocs != null) {
@@ -599,7 +608,8 @@ public class SegmentReader extends Index
     return norm.bytes();
   }
 
-  @Override
+  /** {@inheritDoc} */
+  @Override @Deprecated
   protected void doSetNorm(int doc, String field, byte value)
           throws IOException {
     SegmentNorms norm = norms.get(field);