org.apache.lucene.index
public final class: KeepOnlyLastCommitDeletionPolicy [javadoc |
source]
java.lang.Object
org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy
All Implemented Interfaces:
IndexDeletionPolicy
This
IndexDeletionPolicy implementation that
keeps only the most recent commit and immediately removes
all prior commits after a new commit is done. This is
the default deletion policy.
| Method from org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy Summary: |
|---|
|
onCommit, onInit |
| Method from org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy Detail: |
public void onCommit(List commits) {
// Note that commits.size() should normally be 2 (if not
// called by onInit above):
int size = commits.size();
for(int i=0;i< size-1;i++) {
((IndexCommit) commits.get(i)).delete();
}
}
Deletes all commits except the most recent one. |
public void onInit(List commits) {
// Note that commits.size() should normally be 1:
onCommit(commits);
}
Deletes all commits except the most recent one. |