You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/01/30 20:19:05 UTC

svn commit: r1237938 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/contrib/analyzers/kuromoji/ lucene/src/java/org/apache/lucene/index/ lucene/src/java/org/apache/lucene/store/ solr/ solr/core/

Author: mikemccand
Date: Mon Jan 30 19:19:04 2012
New Revision: 1237938

URL: http://svn.apache.org/viewvc?rev=1237938&view=rev
Log:
LUCENE-3672: deprecate APIs

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/CHANGES.txt
    lucene/dev/branches/branch_3x/lucene/contrib/analyzers/kuromoji/   (props changed)
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexCommit.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/store/Directory.java
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/core/   (props changed)

Modified: lucene/dev/branches/branch_3x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/CHANGES.txt?rev=1237938&r1=1237937&r2=1237938&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/lucene/CHANGES.txt Mon Jan 30 19:19:04 2012
@@ -60,6 +60,11 @@ Changes in backwards compatibility polic
 * LUCENE-3712: Removed unused and untested ReaderUtil#subReader methods.
   (Uwe Schindler)
   
+* LUCENE-3672: Deprecate Directory.fileModified,
+  IndexCommit.getTimestamp and .getVersion and
+  IndexReader.lastModified and getCurrentVersion (Andrzej Bialecki,
+  Robert Muir, Mike McCandless)
+   
 Security fixes
 
 * LUCENE-3588: Try harder to prevent SIGSEGV on cloned MMapIndexInputs:

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexCommit.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexCommit.java?rev=1237938&r1=1237937&r2=1237938&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexCommit.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/index/IndexCommit.java Mon Jan 30 19:19:04 2012
@@ -95,7 +95,9 @@ public abstract class IndexCommit implem
 
   /** Returns the version for this IndexCommit.  This is the
    *  same value that {@link IndexReader#getVersion} would
-   *  return if it were opened on this commit. */
+   *  return if it were opened on this commit.
+   * @deprecated use {@link #getGeneration} instead */
+  @Deprecated
   public abstract long getVersion();
 
   /** Returns the generation (the _N in segments_N) for this
@@ -105,7 +107,12 @@ public abstract class IndexCommit implem
   /** Convenience method that returns the last modified time
    *  of the segments_N file corresponding to this index
    *  commit, equivalent to
-   *  getDirectory().fileModified(getSegmentsFileName()). */
+   *  getDirectory().fileModified(getSegmentsFileName()).
+   * @deprecated If you need to track commit time of
+   * an index, you can store it in the commit data (see
+   * {@link IndexWriter#commit(Map)}
+   */
+  @Deprecated
   public long getTimestamp() throws IOException {
     return getDirectory().fileModified(getSegmentsFileName());
   }
@@ -116,6 +123,10 @@ public abstract class IndexCommit implem
   public abstract Map<String,String> getUserData() throws IOException;
   
   public int compareTo(IndexCommit commit) {
+    if (getDirectory() != commit.getDirectory()) {
+      throw new UnsupportedOperationException("cannot compare IndexCommits from different Directory instances");
+    }
+
     long gen = getGeneration();
     long comgen = commit.getGeneration();
     if (gen < comgen) {

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=1237938&r1=1237937&r2=1237938&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 Mon Jan 30 19:19:04 2012
@@ -910,7 +910,11 @@ public abstract class IndexReader implem
    * {@link #isCurrent()} instead. 
    * @throws CorruptIndexException if the index is corrupt
    * @throws IOException if there is a low-level IO error
+   * @deprecated If you need to track commit time of
+   * an index, you can store it in the commit data (see
+   * {@link IndexWriter#commit(Map)}
    */
+  @Deprecated
   public static long lastModified(final Directory directory2) throws CorruptIndexException, IOException {
     return ((Long) new SegmentInfos.FindSegmentsFile(directory2) {
         @Override
@@ -929,7 +933,9 @@ public abstract class IndexReader implem
    * @return version number.
    * @throws CorruptIndexException if the index is corrupt
    * @throws IOException if there is a low-level IO error
+   * @deprecated Use {@link SegmentInfos#readCurrentVersion}.
    */
+  @Deprecated
   public static long getCurrentVersion(Directory directory) throws CorruptIndexException, IOException {
     return SegmentInfos.readCurrentVersion(directory);
   }
@@ -963,17 +969,6 @@ public abstract class IndexReader implem
    * reader opened.  This version is advanced every time
    * {@link IndexWriter#commit} is called.</p>
    *
-   * <p>If instead this reader is a near real-time reader
-   * (ie, obtained by a call to {@link
-   * IndexWriter#getReader}, or by calling {@link #openIfChanged}
-   * on a near real-time reader), then this method returns
-   * the version of the last commit done by the writer.
-   * Note that even as further changes are made with the
-   * writer, the version will not changed until a commit is
-   * completed.  Thus, you should not rely on this method to
-   * determine when a near real-time reader should be
-   * opened.  Use {@link #isCurrent} instead.</p>
-   *
    * @throws UnsupportedOperationException unless overridden in subclass
    */
   public long getVersion() {

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/store/Directory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/store/Directory.java?rev=1237938&r1=1237937&r2=1237938&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/store/Directory.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/store/Directory.java Mon Jan 30 19:19:04 2012
@@ -62,7 +62,9 @@ public abstract class Directory implemen
   public abstract boolean fileExists(String name)
        throws IOException;
 
-  /** Returns the time the named file was last modified. */
+  /** Returns the time the named file was last modified.
+   * @deprecated */
+  @Deprecated
   public abstract long fileModified(String name)
        throws IOException;