org.apache.lucene.index
Class SnapshotDeletionPolicy.SnapshotCommitPoint

java.lang.Object
  extended by org.apache.lucene.index.IndexCommit
      extended by org.apache.lucene.index.SnapshotDeletionPolicy.SnapshotCommitPoint
All Implemented Interfaces:
Comparable<IndexCommit>
Enclosing class:
SnapshotDeletionPolicy

protected class SnapshotDeletionPolicy.SnapshotCommitPoint
extends IndexCommit


Field Summary
protected  IndexCommit cp
           
 
Constructor Summary
protected SnapshotDeletionPolicy.SnapshotCommitPoint(IndexCommit cp)
           
 
Method Summary
 void delete()
          Delete this commit point.
 Directory getDirectory()
          Returns the Directory for the index.
 Collection<String> getFileNames()
          Returns all index files referenced by this commit point.
 long getGeneration()
          Returns the generation (the _N in segments_N) for this IndexCommit
 String getSegmentsFileName()
          Get the segments file (segments_N) associated with this commit point.
 Map<String,String> getUserData()
          Returns userData, previously passed to IndexWriter.commit(Map) for this commit.
 long getVersion()
          Returns the version for this IndexCommit.
 boolean isDeleted()
           
 boolean isOptimized()
          Returns true if this commit is an optimized index.
protected  boolean shouldDelete(String segmentsFileName)
          Returns true if this segment can be deleted.
 String toString()
           
 
Methods inherited from class org.apache.lucene.index.IndexCommit
compareTo, equals, getTimestamp, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

cp

protected IndexCommit cp
Constructor Detail

SnapshotDeletionPolicy.SnapshotCommitPoint

protected SnapshotDeletionPolicy.SnapshotCommitPoint(IndexCommit cp)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

shouldDelete

protected boolean shouldDelete(String segmentsFileName)
Returns true if this segment can be deleted. The default implementation returns false if this segment is currently held as snapshot.


delete

public void delete()
Description copied from class: IndexCommit
Delete this commit point. This only applies when using the commit point in the context of IndexWriter's IndexDeletionPolicy.

Upon calling this, the writer is notified that this commit point should be deleted.

Decision that a commit-point should be deleted is taken by the IndexDeletionPolicy in effect and therefore this should only be called by its onInit() or onCommit() methods.

Specified by:
delete in class IndexCommit

getDirectory

public Directory getDirectory()
Description copied from class: IndexCommit
Returns the Directory for the index.

Specified by:
getDirectory in class IndexCommit

getFileNames

public Collection<String> getFileNames()
                                throws IOException
Description copied from class: IndexCommit
Returns all index files referenced by this commit point.

Specified by:
getFileNames in class IndexCommit
Throws:
IOException

getGeneration

public long getGeneration()
Description copied from class: IndexCommit
Returns the generation (the _N in segments_N) for this IndexCommit

Specified by:
getGeneration in class IndexCommit

getSegmentsFileName

public String getSegmentsFileName()
Description copied from class: IndexCommit
Get the segments file (segments_N) associated with this commit point.

Specified by:
getSegmentsFileName in class IndexCommit

getUserData

public Map<String,String> getUserData()
                               throws IOException
Description copied from class: IndexCommit
Returns userData, previously passed to IndexWriter.commit(Map) for this commit. Map is String -> String.

Specified by:
getUserData in class IndexCommit
Throws:
IOException

getVersion

public long getVersion()
Description copied from class: IndexCommit
Returns the version for this IndexCommit. This is the same value that IndexReader.getVersion() would return if it were opened on this commit.

Specified by:
getVersion in class IndexCommit

isDeleted

public boolean isDeleted()
Specified by:
isDeleted in class IndexCommit

isOptimized

public boolean isOptimized()
Description copied from class: IndexCommit
Returns true if this commit is an optimized index.

Specified by:
isOptimized in class IndexCommit


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.