FileDocCategorySizeDatePackage
KeepOnlyLastCommitDeletionPolicy.javaAPI DocApache Lucene 2.2.01672Sat Jun 16 22:20:36 BST 2007org.apache.lucene.index

KeepOnlyLastCommitDeletionPolicy

public final class KeepOnlyLastCommitDeletionPolicy extends Object implements IndexDeletionPolicy
This {@link 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.

Fields Summary
Constructors Summary
Methods Summary
public voidonCommit(java.util.List commits)
Deletes all commits except the most recent one.

    // 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++) {
      ((IndexCommitPoint) commits.get(i)).delete();
    }
  
public voidonInit(java.util.List commits)
Deletes all commits except the most recent one.

    // Note that commits.size() should normally be 1:
    onCommit(commits);