Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

removed more unnecessary exist-checks in ErrorCache

Michael Peter Christenfd87fa1613e2
diff --git a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java
index db3f95434..8fda40feb 100644
--- a/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java
+++ b/source/net/yacy/cora/federate/solr/connector/EmbeddedSolrConnector.java
@@ -417,7 +417,9 @@ public class EmbeddedSolrConnector extends SolrServerConnector implements SolrCo
if (doc == null) return null;
return AbstractSolrConnector.getMetadata(doc);
//}
- } catch (Throwable e) {} finally {
+ } catch (Throwable e) {
+ ConcurrentLog.logException(e);
+ } finally {
if (docListSearcher != null) docListSearcher.close();
}
return null;
diff --git a/source/net/yacy/search/index/ErrorCache.java b/source/net/yacy/search/index/ErrorCache.java
index b8828b918..9b19217c4 100644
--- a/source/net/yacy/search/index/ErrorCache.java
+++ b/source/net/yacy/search/index/ErrorCache.java
@@ -109,7 +109,7 @@ public class ErrorCache {
url, profile == null ? null : profile.collections(),
failCategory.name() + " " + reason, failCategory.failType,
httpcode, crawldepth);
- if (this.fulltext.getDefaultConnector() != null && failCategory.store && !exists(url.hash())) {
+ if (this.fulltext.getDefaultConnector() != null && failCategory.store) {
// send the error to solr
try {
// do not overwrite error reports with error reports
@@ -189,12 +189,10 @@ public class ErrorCache {
public boolean exists(final byte[] urlHash) {
String urlHashString = ASCII.String(urlHash);
try {
- // first try to check if the document exists at all.
- long loaddate = this.fulltext.getLoadTime(urlHashString);
- if (loaddate < 0) return false;
- // then load the fail reason, if exists
+ // load the fail reason, if exists
final SolrDocument doc = this.fulltext.getDefaultConnector().getDocumentById(urlHashString, CollectionSchema.failreason_s.getSolrFieldName());
if (doc == null) return false;
+
// check if the document contains a value in the field CollectionSchema.failreason_s
Object failreason = doc.getFieldValue(CollectionSchema.failreason_s.getSolrFieldName());
return failreason != null && failreason.toString().length() > 0;