mirror of https://github.com/apache/lucene.git
un-deprecate lastModified() and getCurrentVersion()
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@188856 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4fd3b6899d
commit
af42440fc0
|
@ -175,70 +175,52 @@ public abstract class IndexReader {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time the index in the named directory was last modified.
|
* Returns the time the index in the named directory was last modified.
|
||||||
*
|
* Do not use this to check whether the reader is still up-to-date, use
|
||||||
* <p>Synchronization of IndexReader and IndexWriter instances is
|
* {@link #isCurrent()} instead.
|
||||||
* no longer done via time stamps of the segments file since the time resolution
|
*/
|
||||||
* depends on the hardware platform. Instead, a version number is maintained
|
|
||||||
* within the segments file, which is incremented everytime when the index is
|
|
||||||
* changed.</p>
|
|
||||||
*
|
|
||||||
* @deprecated Replaced by {@link #getCurrentVersion(String)}
|
|
||||||
* */
|
|
||||||
public static long lastModified(String directory) throws IOException {
|
public static long lastModified(String directory) throws IOException {
|
||||||
return lastModified(new File(directory));
|
return lastModified(new File(directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time the index in the named directory was last modified.
|
* Returns the time the index in the named directory was last modified.
|
||||||
*
|
* Do not use this to check whether the reader is still up-to-date, use
|
||||||
* <p>Synchronization of IndexReader and IndexWriter instances is
|
* {@link #isCurrent()} instead.
|
||||||
* no longer done via time stamps of the segments file since the time resolution
|
*/
|
||||||
* depends on the hardware platform. Instead, a version number is maintained
|
|
||||||
* within the segments file, which is incremented everytime when the index is
|
|
||||||
* changed.</p>
|
|
||||||
*
|
|
||||||
* @deprecated Replaced by {@link #getCurrentVersion(File)}
|
|
||||||
* */
|
|
||||||
public static long lastModified(File directory) throws IOException {
|
public static long lastModified(File directory) throws IOException {
|
||||||
return FSDirectory.fileModified(directory, Constants.INDEX_SEGMENTS_FILENAME);
|
return FSDirectory.fileModified(directory, Constants.INDEX_SEGMENTS_FILENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the time the index in the named directory was last modified.
|
* Returns the time the index in the named directory was last modified.
|
||||||
*
|
* Do not use this to check whether the reader is still up-to-date, use
|
||||||
* <p>Synchronization of IndexReader and IndexWriter instances is
|
* {@link #isCurrent()} instead.
|
||||||
* no longer done via time stamps of the segments file since the time resolution
|
*/
|
||||||
* depends on the hardware platform. Instead, a version number is maintained
|
|
||||||
* within the segments file, which is incremented everytime when the index is
|
|
||||||
* changed.</p>
|
|
||||||
*
|
|
||||||
* @deprecated Replaced by {@link #getCurrentVersion(Directory)}
|
|
||||||
* */
|
|
||||||
public static long lastModified(Directory directory) throws IOException {
|
public static long lastModified(Directory directory) throws IOException {
|
||||||
return directory.fileModified(Constants.INDEX_SEGMENTS_FILENAME);
|
return directory.fileModified(Constants.INDEX_SEGMENTS_FILENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads version number from segments files. The version number counts the
|
* Reads version number from segments files. The version number is
|
||||||
* number of changes of the index.
|
* initialized with a timestamp and then increased by one for each change of
|
||||||
|
* the index.
|
||||||
*
|
*
|
||||||
* @param directory where the index resides.
|
* @param directory where the index resides.
|
||||||
* @return version number.
|
* @return version number.
|
||||||
* @throws IOException if segments file cannot be read
|
* @throws IOException if segments file cannot be read
|
||||||
* @deprecated use {@link #isCurrent()} instead
|
|
||||||
*/
|
*/
|
||||||
public static long getCurrentVersion(String directory) throws IOException {
|
public static long getCurrentVersion(String directory) throws IOException {
|
||||||
return getCurrentVersion(new File(directory));
|
return getCurrentVersion(new File(directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads version number from segments files. The version number counts the
|
* Reads version number from segments files. The version number is
|
||||||
* number of changes of the index.
|
* initialized with a timestamp and then increased by one for each change of
|
||||||
|
* the index.
|
||||||
*
|
*
|
||||||
* @param directory where the index resides.
|
* @param directory where the index resides.
|
||||||
* @return version number.
|
* @return version number.
|
||||||
* @throws IOException if segments file cannot be read
|
* @throws IOException if segments file cannot be read
|
||||||
* @deprecated use {@link #isCurrent()} instead
|
|
||||||
*/
|
*/
|
||||||
public static long getCurrentVersion(File directory) throws IOException {
|
public static long getCurrentVersion(File directory) throws IOException {
|
||||||
Directory dir = FSDirectory.getDirectory(directory, false);
|
Directory dir = FSDirectory.getDirectory(directory, false);
|
||||||
|
@ -248,13 +230,13 @@ public abstract class IndexReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads version number from segments files. The version number counts the
|
* Reads version number from segments files. The version number is
|
||||||
* number of changes of the index.
|
* initialized with a timestamp and then increased by one for each change of
|
||||||
|
* the index.
|
||||||
*
|
*
|
||||||
* @param directory where the index resides.
|
* @param directory where the index resides.
|
||||||
* @return version number.
|
* @return version number.
|
||||||
* @throws IOException if segments file cannot be read.
|
* @throws IOException if segments file cannot be read.
|
||||||
* @deprecated use {@link #isCurrent()} instead
|
|
||||||
*/
|
*/
|
||||||
public static long getCurrentVersion(Directory directory) throws IOException {
|
public static long getCurrentVersion(Directory directory) throws IOException {
|
||||||
return SegmentInfos.readCurrentVersion(directory);
|
return SegmentInfos.readCurrentVersion(directory);
|
||||||
|
|
Loading…
Reference in New Issue