Package org.apache.lucene.index
Class KeepOnlyLastCommitDeletionPolicy
java.lang.Object
org.apache.lucene.index.IndexDeletionPolicy
org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy
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.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onCommit
(List<? extends IndexCommit> commits) Deletes all commits except the most recent one.void
onInit
(List<? extends IndexCommit> commits) Deletes all commits except the most recent one.
-
Constructor Details
-
KeepOnlyLastCommitDeletionPolicy
public KeepOnlyLastCommitDeletionPolicy()Sole constructor.
-
-
Method Details
-
onInit
Deletes all commits except the most recent one.- Specified by:
onInit
in 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
Deletes all commits except the most recent one.- Specified by:
onCommit
in classIndexDeletionPolicy
- Parameters:
commits
- List ofIndexCommit
, sorted by age (the 0th one is the oldest commit).
-