From edb0ef7344e28d6385cdcd2908af5c761af219bf Mon Sep 17 00:00:00 2001 From: Serhey Dolgushev Date: Wed, 12 Jun 2019 13:15:01 -0400 Subject: [PATCH 1/2] 30664: Skipped indexing erroneous Content and logged all exceptions --- eZ/Publish/Core/Search/Legacy/Content/Indexer.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/eZ/Publish/Core/Search/Legacy/Content/Indexer.php b/eZ/Publish/Core/Search/Legacy/Content/Indexer.php index 6f5866ad988..d35c22d4c4d 100644 --- a/eZ/Publish/Core/Search/Legacy/Content/Indexer.php +++ b/eZ/Publish/Core/Search/Legacy/Content/Indexer.php @@ -8,6 +8,7 @@ */ namespace eZ\Publish\Core\Search\Legacy\Content; +use Exception; use eZ\Publish\API\Repository\Exceptions\NotFoundException; use eZ\Publish\Core\Persistence\Database\DatabaseHandler; use eZ\Publish\Core\Search\Common\IncrementalIndexer; @@ -46,6 +47,12 @@ public function updateSearchIndex(array $contentIds, $commit) } } catch (NotFoundException $e) { $this->searchHandler->deleteContent($contentId); + } catch (Exception $e) { + $context = [ + 'contentId' => $contentId, + 'error' => $e->getMessage(), + ]; + $this->logger->error('Unable to index the content', $context); } } } From eb3b40e99e1ebc1628469067972fa577da222d7d Mon Sep 17 00:00:00 2001 From: Serhey Dolgushev Date: Wed, 19 Jun 2019 12:18:00 -0400 Subject: [PATCH 2/2] 30664: Updated doc for IncrementalIndexer::updateSearchIndex() --- eZ/Publish/Core/Search/Common/IncrementalIndexer.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/eZ/Publish/Core/Search/Common/IncrementalIndexer.php b/eZ/Publish/Core/Search/Common/IncrementalIndexer.php index 24a7e2a76bc..c32966733b9 100644 --- a/eZ/Publish/Core/Search/Common/IncrementalIndexer.php +++ b/eZ/Publish/Core/Search/Common/IncrementalIndexer.php @@ -71,6 +71,8 @@ final public function createSearchIndex(OutputInterface $output, $iterationCount * - not published (draft or trashed) * Then item is removed from index, if not it is added/updated. * + * If generic unhandled exception is thrown, then item indexing is skipped and warning is logged. + * * @param int[] $contentIds * @param bool $commit */