LUCENE-1367: add IndexCommit.isDeleted()

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@689791 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2008-08-28 11:50:15 +00:00
parent 82c70c018e
commit 4661a1b02b
6 changed files with 20 additions and 1 deletions

View File

@ -122,6 +122,9 @@ API Changes
3.0 the default will become true. (Jason Rutherglen via Mike
McCandless)
19. LUCENE-1367: Add IndexCommit.isDeleted(). (Shalin Shekhar Mangar
via Mike McCandless)
Bug fixes
1. LUCENE-1134: Fixed BooleanQuery.rewrite to only optimize a single

View File

@ -401,6 +401,9 @@ abstract class DirectoryIndexReader extends IndexReader {
public long getGeneration() {
return generation;
}
public boolean isDeleted() {
return false;
}
}
/**

View File

@ -74,6 +74,10 @@ public abstract class IndexCommit implements IndexCommitPoint {
throw new UnsupportedOperationException("This IndexCommit does not support this method.");
}
public boolean isDeleted() {
throw new UnsupportedOperationException("This IndexCommit does not support this method.");
}
/**
* Returns true if this commit is an optimized index.
*/

View File

@ -637,6 +637,10 @@ final class IndexFileDeleter {
}
}
public boolean isDeleted() {
return deleted;
}
public int compareTo(Object obj) {
CommitPoint commit = (CommitPoint) obj;
if (gen < commit.gen) {

View File

@ -109,6 +109,9 @@ public class SnapshotDeletionPolicy implements IndexDeletionPolicy {
cp.delete();
}
}
public boolean isDeleted() {
return cp.isDeleted();
}
public long getVersion() {
return cp.getVersion();
}

View File

@ -89,7 +89,9 @@ public class TestDeletionPolicy extends LuceneTestCase
// On init, delete all commit points:
Iterator it = commits.iterator();
while(it.hasNext()) {
((IndexCommit) it.next()).delete();
final IndexCommit commit = (IndexCommit) it.next();
commit.delete();
assertTrue(commit.isDeleted());
}
}
public void onCommit(List commits) {