public virtual void BackupIndex(Directory dir, SnapshotDeletionPolicy dp)
{
// To backup an index we first take a snapshot:
IndexCommit snapshot = dp.Snapshot();
try
{
CopyFiles(dir, snapshot);
}
finally
{
// Make sure to release the snapshot, otherwise these
// files will never be deleted during this IndexWriter
// session:
dp.Release(snapshot);
}
}