Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Use IndexCommit#getTimestamp added in Lucene 2.4

Shalin Shekhar Mangar0d8d200c20d9
diff --git a/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java b/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
index 0504b1b942c..964077dcc22 100644
--- a/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
+++ b/src/java/org/apache/solr/core/IndexDeletionPolicyWrapper.java
@@ -133,6 +133,10 @@ public class IndexDeletionPolicyWrapper implements IndexDeletionPolicy {
public boolean isDeleted() {
return delegate.isDeleted();
}
+
+ public long getTimestamp() throws IOException {
+ return delegate.getTimestamp();
+ }
}
/**
diff --git a/src/java/org/apache/solr/core/SolrDeletionPolicy.java b/src/java/org/apache/solr/core/SolrDeletionPolicy.java
index c8490177c01..b74de7aacdd 100644
--- a/src/java/org/apache/solr/core/SolrDeletionPolicy.java
+++ b/src/java/org/apache/solr/core/SolrDeletionPolicy.java
@@ -122,9 +122,8 @@ public class SolrDeletionPolicy implements IndexDeletionPolicy, NamedListInitial
}
try {
- //TODO: replace LHS of if condition with commit.getTimestamp()
if (maxCommitAge != null)
- if (commit.getDirectory().fileModified(commit.getSegmentsFileName()) < dmp.parseMath(maxCommitAge).getTime()) {
+ if (commit.getTimestamp() < dmp.parseMath(maxCommitAge).getTime()) {
commit.delete();
continue;
}