public function addProducts($productIds)
    {
        $fullTextIndexer    = $this->indexerRegistry->get(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID);
        $indexerChangeLog   = $fullTextIndexer->getView()->getChangelog();

        $changelogTableName = $indexerChangeLog->getName();
        $columnName         = $indexerChangeLog->getColumnName();

        try {
            $indexerChangeLog->create();

            $this->resource->getConnection()->insertArray(
                $changelogTableName,
                [$columnName],
                $productIds
            );
        } catch (\Exception $e) {
            throw new CouldNotSaveException(__(
                'Could not schedule products for reindexing : %1',
                $e->getMessage()
            ));
        }
    }
public function addProducts($productIds)
    {
        $fullTextIndexer    = $this->indexerRegistry->get(\Magento\CatalogSearch\Model\Indexer\Fulltext::INDEXER_ID);
        $indexerChangeLog   = $fullTextIndexer->getView()->getChangelog();

        $changelogTableName = $indexerChangeLog->getName();
        $columnName         = $indexerChangeLog->getColumnName();

        try {
            $indexerChangeLog->create();

            $this->resource->getConnection()->insertArray(
                $changelogTableName,
                [$columnName],
                $productIds
            );
        } catch (\Exception $e) {
            throw new CouldNotSaveException(__(
                'Could not schedule products for reindexing : %1',
                $e->getMessage()
            ));
        }
    }
public function addProducts ( $ productIds ) { $ fullTextIndexer = $ this -> indexerRegistry -> get ( \ Magento \ CatalogSearch \ Model \ Indexer \ Fulltext :: INDEXER_ID ) ; $ indexerChangeLog = $ fullTextIndexer -> getView ( ) -> getChangelog ( ) ; $ changelogTableName = $ indexerChangeLog -> getName ( ) ; $ columnName = $ indexerChangeLog -> getColumnName ( ) ; try { $ indexerChangeLog -> create ( ) ; $ this -> resource -> getConnection ( ) -> insertArray ( $ changelogTableName , [ $ columnName ] , $ productIds ) ; } catch ( \ Exception $ e ) { throw new CouldNotSaveException ( __ ( 'Could not schedule products for reindexing : %1' , $ e -> getMessage ( ) ) ) ; } }
Add products to the fulltext indexer changelog table

@param array $productIds IDs of products to schedule for reindexing

@return void
@throws CouldNotSaveException
Add products to the fulltext indexer changelog table