Skip to content

Commit e03b5c0

Browse files
committed
MAGETWO-40028: CatalogSearch indexer fails when reindex by cron is executed
1 parent 5e8b706 commit e03b5c0

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\CatalogSearch\Model\Indexer\Mview;
8+
9+
10+
use Magento\CatalogSearch\Model\Indexer\Fulltext;
11+
use Magento\Framework\Mview\ActionInterface;
12+
use Magento\Indexer\Model\IndexerInterfaceFactory;
13+
14+
class Action implements ActionInterface
15+
{
16+
/**
17+
* @var IndexerInterfaceFactory
18+
*/
19+
private $indexerFactory;
20+
21+
/**
22+
* @param IndexerInterfaceFactory $indexerFactory
23+
*/
24+
public function __construct(IndexerInterfaceFactory $indexerFactory)
25+
{
26+
$this->indexerFactory = $indexerFactory;
27+
}
28+
29+
/**
30+
* Execute materialization on ids entities
31+
*
32+
* @param int[] $ids
33+
* @return void
34+
* @api
35+
*/
36+
public function execute($ids)
37+
{
38+
/** @var \Magento\Indexer\Model\IndexerInterface $indexer */
39+
$indexer = $this->indexerFactory->create()->load(Fulltext::INDEXER_ID);
40+
$indexer->reindexList($ids);
41+
}
42+
43+
}

app/code/Magento/CatalogSearch/etc/mview.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Mview/etc/mview.xsd">
9-
<view id="catalogsearch_fulltext" class="Magento\CatalogSearch\Model\Indexer\Fulltext" group="indexer">
9+
<view id="catalogsearch_fulltext" class="\Magento\CatalogSearch\Model\Indexer\Mview\Action" group="indexer">
1010
<subscriptions>
1111
<table name="catalog_product_entity" entity_column="entity_id" />
1212
<table name="catalog_product_entity_int" entity_column="entity_id" />

0 commit comments

Comments
 (0)