mirror of
https://github.com/silverstripe/silverstripe-fulltextsearch
synced 2024-10-22 12:05:29 +00:00
Logging Solr communication exceptions as warnings
Before we didn't catch exceptions, the CMS would break when communication errors with Solr occurred, this change will log those exceptions as warnings so that creating new and publishing pages will continue gracefully.
This commit is contained in:
parent
be2b45123f
commit
4f58937636
@ -167,7 +167,12 @@ abstract class SolrIndex extends SearchIndex {
|
||||
if ($field['base'] == $base) $this->_addField($doc, $object, $field);
|
||||
}
|
||||
|
||||
$this->getService()->addDocument($doc);
|
||||
try {
|
||||
$this->getService()->addDocument($doc);
|
||||
} catch (Exception $e) {
|
||||
SS_Log::log($e, SS_Log::WARN);
|
||||
return false;
|
||||
}
|
||||
|
||||
return $doc;
|
||||
}
|
||||
@ -195,11 +200,22 @@ abstract class SolrIndex extends SearchIndex {
|
||||
|
||||
function delete($base, $id, $state) {
|
||||
$documentID = $this->getDocumentIDForState($base, $id, $state);
|
||||
$this->getService()->deleteById($documentID);
|
||||
|
||||
try {
|
||||
$this->getService()->deleteById($documentID);
|
||||
} catch (Exception $e) {
|
||||
SS_Log::log($e, SS_Log::WARN);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function commit() {
|
||||
$this->getService()->commit(false, false, false);
|
||||
try {
|
||||
$this->getService()->commit(false, false, false);
|
||||
} catch (Exception $e) {
|
||||
SS_Log::log($e, SS_Log::WARN);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user