mirror of https://github.com/apache/lucene.git
LUCENE-2417: changed IndexCommit methods to abstract
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@939649 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bb69d0f207
commit
9f2cd93b93
|
@ -284,8 +284,9 @@ Bug fixes
|
|||
called. (Ruben Laguna, Uwe Schindler, Mike McCandless)
|
||||
|
||||
* LUCENE-2417: IndexCommit did not implement hashCode() and equals()
|
||||
consitently. Now they both take Directory and version into consideration.
|
||||
(Shai Erera)
|
||||
consitently. Now they both take Directory and version into consideration. In
|
||||
addition, all of IndexComnmit methods which threw
|
||||
UnsupportedOperationException are now abstract. (Shai Erera)
|
||||
|
||||
* LUCENE-2424: Fix FieldDoc.toString to actually return its fields
|
||||
(Stephen Green via Mike McCandless)
|
||||
|
|
|
@ -1125,6 +1125,11 @@ class DirectoryReader extends IndexReader implements Cloneable {
|
|||
public Map<String,String> getUserData() {
|
||||
return userData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete() {
|
||||
throw new UnsupportedOperationException("This IndexCommit does not support deletions");
|
||||
}
|
||||
}
|
||||
|
||||
// @deprecated This is pre-flex API
|
||||
|
|
|
@ -70,24 +70,14 @@ public abstract class IndexCommit {
|
|||
* and therefore this should only be called by its {@link IndexDeletionPolicy#onInit onInit()} or
|
||||
* {@link IndexDeletionPolicy#onCommit onCommit()} methods.
|
||||
*/
|
||||
public void delete() {
|
||||
throw new UnsupportedOperationException("This IndexCommit does not support this method.");
|
||||
}
|
||||
public abstract void delete();
|
||||
|
||||
public boolean isDeleted() {
|
||||
throw new UnsupportedOperationException("This IndexCommit does not support this method.");
|
||||
}
|
||||
public abstract boolean isDeleted();
|
||||
|
||||
/**
|
||||
* Returns true if this commit is an optimized index.
|
||||
*/
|
||||
public boolean isOptimized() {
|
||||
throw new UnsupportedOperationException("This IndexCommit does not support this method.");
|
||||
}
|
||||
/** Returns true if this commit is an optimized index. */
|
||||
public abstract boolean isOptimized();
|
||||
|
||||
/**
|
||||
* Two IndexCommits are equal if both their Directory and versions are equal.
|
||||
*/
|
||||
/** Two IndexCommits are equal if both their Directory and versions are equal. */
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof IndexCommit) {
|
||||
|
@ -105,15 +95,11 @@ public abstract class IndexCommit {
|
|||
/** Returns the version for this IndexCommit. This is the
|
||||
* same value that {@link IndexReader#getVersion} would
|
||||
* return if it were opened on this commit. */
|
||||
public long getVersion() {
|
||||
throw new UnsupportedOperationException("This IndexCommit does not support this method.");
|
||||
}
|
||||
public abstract long getVersion();
|
||||
|
||||
/** Returns the generation (the _N in segments_N) for this
|
||||
* IndexCommit */
|
||||
public long getGeneration() {
|
||||
throw new UnsupportedOperationException("This IndexCommit does not support this method.");
|
||||
}
|
||||
public abstract long getGeneration();
|
||||
|
||||
/** Convenience method that returns the last modified time
|
||||
* of the segments_N file corresponding to this index
|
||||
|
@ -126,7 +112,6 @@ public abstract class IndexCommit {
|
|||
/** Returns userData, previously passed to {@link
|
||||
* IndexWriter#commit(Map)} for this commit. Map is
|
||||
* String -> String. */
|
||||
public Map<String,String> getUserData() throws IOException {
|
||||
throw new UnsupportedOperationException("This IndexCommit does not support this method.");
|
||||
}
|
||||
public abstract Map<String,String> getUserData() throws IOException;
|
||||
|
||||
}
|
||||
|
|
|
@ -132,6 +132,10 @@ public class SnapshotDeletionPolicy implements IndexDeletionPolicy {
|
|||
public Map<String,String> getUserData() throws IOException {
|
||||
return cp.getUserData();
|
||||
}
|
||||
@Override
|
||||
public boolean isOptimized() {
|
||||
return cp.isOptimized();
|
||||
}
|
||||
}
|
||||
|
||||
private List<IndexCommit> wrapCommits(List<? extends IndexCommit> commits) {
|
||||
|
|
Loading…
Reference in New Issue