diff --git a/Model/Post/Indexer/Fulltext/Action/Full.php b/Model/Post/Indexer/Fulltext/Action/Full.php index 45b2fa1..036a3a9 100755 --- a/Model/Post/Indexer/Fulltext/Action/Full.php +++ b/Model/Post/Indexer/Fulltext/Action/Full.php @@ -1,8 +1,12 @@ resourceModel = $resourceModel; $this->filterProvider = $filterProvider; + $this->areaList = $areaList; + $this->stripTags = $stripTags; } /** @@ -40,6 +62,13 @@ public function rebuildStoreIndex($storeId, $blogPostIds = null) { $lastBlogPostId = 0; + try { + $this->areaList->getArea(Area::AREA_FRONTEND)->load(Area::PART_DESIGN); + } catch (\InvalidArgumentException | \LogicException $exception) { + // Can occur especially when magento sample data are triggering a full reindex. + ; + } + do { $blogPosts = $this->getSearchableBlogPost($storeId, $blogPostIds, $lastBlogPostId); foreach ($blogPosts as $postData) { @@ -75,9 +104,11 @@ private function getSearchableBlogPost($storeId, $blogPostIds = null, $fromId = private function processPostData($postData) { if (isset($postData['content'])) { - $postData['content'] = $this->filterProvider->getPageFilter()->filter($postData['content']); + $content = html_entity_decode($this->filterProvider->getPageFilter()->filter($postData['content'])); + $content = $this->stripTags->filter($content); + $content = preg_replace('/\s\s+/', ' ', $content); + $postData['content'] = $content; } - return $postData; } }