diff --git a/Classes/Configuration/NoConfigurationException.php b/Classes/Configuration/NoConfigurationException.php new file mode 100755 index 0000000..bc6c1ba --- /dev/null +++ b/Classes/Configuration/NoConfigurationException.php @@ -0,0 +1,25 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +class NoConfigurationException extends \InvalidArgumentException +{ +} diff --git a/Classes/Connection/Elasticsearch.php b/Classes/Connection/Elasticsearch.php index 4cce11b..560ca07 100644 --- a/Classes/Connection/Elasticsearch.php +++ b/Classes/Connection/Elasticsearch.php @@ -92,12 +92,16 @@ class Elasticsearch implements Singleton, ConnectionInterface public function deleteDocument($documentType, $identifier) { - $this->withType( - $documentType, - function ($type) use ($identifier) { - $type->deleteById($identifier); - } - ); + try { + $this->withType( + $documentType, + function ($type) use ($identifier) { + $type->deleteById($identifier); + } + ); + } catch (\Elastica\Exception\NotFoundException $exception) { + $this->logger->debug('Tried to delete document in index, which does not exist.', [$documentType, $identifier]); + } } public function updateDocument($documentType, array $document) diff --git a/Classes/Domain/Index/NoRecordFoundException.php b/Classes/Domain/Index/NoRecordFoundException.php new file mode 100755 index 0000000..8a92408 --- /dev/null +++ b/Classes/Domain/Index/NoRecordFoundException.php @@ -0,0 +1,25 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +class NoRecordFoundException extends IndexingException +{ +}