mirror of https://github.com/apache/lucene.git
Fixed a bug in IndexReader.lastModified().
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@149833 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5dbea95485
commit
689293d13b
|
@ -85,7 +85,10 @@ $Id$
|
|||
need to be reconstructed once per day. (cutting)
|
||||
|
||||
15. Added a new IndexWriter method, getAnalyzer(). This returns the
|
||||
analyzer used when adding documents to this index.
|
||||
analyzer used when adding documents to this index. (cutting)
|
||||
|
||||
16. Fixed a bug with IndexReader.lastModified(). Before, document
|
||||
deletion did not update this. Now it does. (cutting)
|
||||
|
||||
|
||||
1.2 RC6
|
||||
|
|
|
@ -121,6 +121,7 @@ final class SegmentReader extends IndexReader {
|
|||
public Object doBody() throws IOException {
|
||||
deletedDocs.write(directory, segment + ".tmp");
|
||||
directory.renameFile(segment + ".tmp", segment + ".del");
|
||||
directory.touchFile("segments");
|
||||
return null;
|
||||
}
|
||||
}.run();
|
||||
|
|
|
@ -82,6 +82,10 @@ abstract public class Directory {
|
|||
abstract public long fileModified(String name)
|
||||
throws IOException, SecurityException;
|
||||
|
||||
/** Set the modified time of an existing file to now. */
|
||||
abstract public void touchFile(String name)
|
||||
throws IOException, SecurityException;
|
||||
|
||||
/** Removes an existing file in the directory. */
|
||||
abstract public void deleteFile(String name)
|
||||
throws IOException, SecurityException;
|
||||
|
|
|
@ -175,6 +175,12 @@ final public class FSDirectory extends Directory {
|
|||
return file.lastModified();
|
||||
}
|
||||
|
||||
/** Set the modified time of an existing file to now. */
|
||||
public void touchFile(String name) throws IOException, SecurityException {
|
||||
File file = new File(directory, name);
|
||||
file.setLastModified(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/** Returns the length in bytes of a file in the directory. */
|
||||
public final long fileLength(String name) throws IOException {
|
||||
File file = new File(directory, name);
|
||||
|
|
|
@ -93,6 +93,12 @@ final public class RAMDirectory extends Directory {
|
|||
return file.lastModified;
|
||||
}
|
||||
|
||||
/** Set the modified time of an existing file to now. */
|
||||
public void touchFile(String name) throws IOException, SecurityException {
|
||||
RAMFile file = (RAMFile)files.get(name);
|
||||
file.lastModified = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/** Returns the length in bytes of a file in the directory. */
|
||||
public final long fileLength(String name) {
|
||||
RAMFile file = (RAMFile)files.get(name);
|
||||
|
|
Loading…
Reference in New Issue