Package org.apache.lucene.index
Class KeepOnlyLastCommitDeletionPolicy
- java.lang.Object
 - 
- org.apache.lucene.index.IndexDeletionPolicy
 - 
- org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy
 
 
 
- 
- All Implemented Interfaces:
 java.lang.Cloneable
public final class KeepOnlyLastCommitDeletionPolicy extends IndexDeletionPolicy
ThisIndexDeletionPolicyimplementation 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. 
- 
- 
Constructor Summary
Constructors Constructor Description KeepOnlyLastCommitDeletionPolicy()Sole constructor. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonCommit(java.util.List<? extends IndexCommit> commits)Deletes all commits except the most recent one.voidonInit(java.util.List<? extends IndexCommit> commits)Deletes all commits except the most recent one.- 
Methods inherited from class org.apache.lucene.index.IndexDeletionPolicy
clone 
 - 
 
 - 
 
- 
- 
Method Detail
- 
onInit
public void onInit(java.util.List<? extends IndexCommit> commits)
Deletes all commits except the most recent one.- Specified by:
 onInitin classIndexDeletionPolicy- Parameters:
 commits- List of currentpoint-in-time commits, sorted by age (the 0th one is the oldest commit). Note that for a new index this method is invoked with an empty list.
 
- 
onCommit
public void onCommit(java.util.List<? extends IndexCommit> commits)
Deletes all commits except the most recent one.- Specified by:
 onCommitin classIndexDeletionPolicy- Parameters:
 commits- List ofIndexCommit, sorted by age (the 0th one is the oldest commit).
 
 - 
 
 -