public abstract class IndexCommit extends java.lang.Object implements java.lang.Comparable<IndexCommit>
Expert: represents a single commit into an index as seen by the
IndexDeletionPolicy
or IndexReader
.
Changes to the content of an index are made visible
only after the writer who made that change commits by
writing a new segments file
(segments_N
). This point in time, when the
action of writing of a new segments file to the directory
is completed, is an index commit.
Each index commit point has a unique segments file associated with it. The segments file associated with a later index commit point would have a larger N.
Modifier | Constructor and Description |
---|---|
protected |
IndexCommit()
Sole constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(IndexCommit commit) |
abstract void |
delete()
Delete this commit point.
|
boolean |
equals(java.lang.Object other)
Two IndexCommits are equal if both their Directory and versions are equal.
|
abstract Directory |
getDirectory()
Returns the
Directory for the index. |
abstract java.util.Collection<java.lang.String> |
getFileNames()
Returns all index files referenced by this commit point.
|
abstract long |
getGeneration()
Returns the generation (the _N in segments_N) for this
IndexCommit
|
abstract int |
getSegmentCount()
Returns number of segments referenced by this commit.
|
abstract java.lang.String |
getSegmentsFileName()
Get the segments file (
segments_N ) associated
with this commit point. |
abstract java.util.Map<java.lang.String,java.lang.String> |
getUserData()
Returns userData, previously passed to
IndexWriter.setLiveCommitData(Iterable) for this commit. |
int |
hashCode() |
abstract boolean |
isDeleted()
Returns true if this commit should be deleted; this is
only used by
IndexWriter after invoking the
IndexDeletionPolicy . |
protected IndexCommit()
public abstract java.lang.String getSegmentsFileName()
segments_N
) associated
with this commit point.public abstract java.util.Collection<java.lang.String> getFileNames() throws java.io.IOException
java.io.IOException
public abstract void delete()
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.
public abstract boolean isDeleted()
IndexWriter
after invoking the
IndexDeletionPolicy
.public abstract int getSegmentCount()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public abstract long getGeneration()
public abstract java.util.Map<java.lang.String,java.lang.String> getUserData() throws java.io.IOException
IndexWriter.setLiveCommitData(Iterable)
for this commit. Map is
String -> String
.java.io.IOException
public int compareTo(IndexCommit commit)
compareTo
in interface java.lang.Comparable<IndexCommit>
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.