removed more unnecessary exist-checks in ErrorCache

pull/1/head
Michael Peter Christen 11 years ago
parent f2b476e08b
commit fd87fa1613

@ -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;

@ -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;

Loading…
Cancel
Save