-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from afoucret/feature-index_handler_refactor
Feature index handler refactor
- Loading branch information
Showing
13 changed files
with
188 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
src/module-elasticsuite-catalog/Model/Category/Indexer/IndexerHandler.php
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
src/module-elasticsuite-catalog/Model/Product/Indexer/IndexerHandler.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
|
||
namespace Smile\ElasticSuiteCatalog\Model\ResourceModel\Category\Indexer\Fulltext\Action; | ||
|
||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\AbstractIndexer; | ||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\Indexer; | ||
|
||
/** | ||
* ElasticSearch category full indexer resource model. | ||
|
@@ -22,7 +22,7 @@ | |
* @package Smile_ElasticSuiteCatalog | ||
* @author Aurelien FOUCRET <[email protected]> | ||
*/ | ||
class Full extends AbstractIndexer | ||
class Full extends Indexer | ||
{ | ||
/** | ||
* Load a bulk of category data. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
|
||
namespace Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\Fulltext\Datasource; | ||
|
||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\AbstractIndexer; | ||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\Indexer; | ||
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Collection as AttributeCollection; | ||
|
||
/** | ||
|
@@ -23,7 +23,7 @@ | |
* @package Smile_ElasticSuiteCatalog | ||
* @author Romain Ruaud <[email protected]> | ||
*/ | ||
class AbstractAttributeData extends AbstractIndexer | ||
class AbstractAttributeData extends Indexer | ||
{ | ||
/** | ||
* @var array | ||
|
52 changes: 52 additions & 0 deletions
52
src/module-elasticsuite-catalog/Model/ResourceModel/Eav/Indexer/Indexer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile Elastic Suite to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile_ElasticSuiteCore | ||
* @author Aurelien FOUCRET <[email protected]> | ||
* @author Fanny DECLERCK <[email protected]> | ||
* @copyright 2016 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
namespace Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer; | ||
|
||
use Magento\Framework\App\ResourceConnection; | ||
use Smile\ElasticSuiteCore\Model\ResourceModel\Indexer\AbstractIndexer; | ||
|
||
/** | ||
* This class provides a lot of util methods used by Eav indexer related resource models. | ||
* | ||
* @category Smile | ||
* @package Smile_ElasticSuiteCatalog | ||
* @author Aurelien FOUCRET <[email protected]> | ||
* @author Fanny DECLERCK <[email protected]> | ||
*/ | ||
class Indexer extends AbstractIndexer | ||
{ | ||
/** | ||
* @var \Magento\Store\Model\StoreManagerInterface | ||
*/ | ||
protected $storeManager; | ||
|
||
/** | ||
* Retrieve store root category id. | ||
* | ||
* @param \Magento\Store\Api\Data\StoreInterface|int|string $store Store id. | ||
* | ||
* @return integer | ||
*/ | ||
protected function getRootCategoryId($store) | ||
{ | ||
if (is_numeric($store) || is_string($store)) { | ||
$store = $this->getStore($store); | ||
} | ||
|
||
$storeGroupId = $store->getStoreGroupId(); | ||
|
||
return $this->storeManager->getGroup($storeGroupId)->getRootCategoryId(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
|
||
namespace Smile\ElasticSuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Action; | ||
|
||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\AbstractIndexer; | ||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\Indexer; | ||
|
||
/** | ||
* ElasticSearch product full indexer resource model. | ||
|
@@ -23,7 +23,7 @@ | |
* @package Smile_ElasticSuiteCatalog | ||
* @author Aurelien FOUCRET <[email protected]> | ||
*/ | ||
class Full extends AbstractIndexer | ||
class Full extends Indexer | ||
{ | ||
/** | ||
* Load a bulk of product data. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
use Magento\Eav\Model\Config; | ||
use Magento\Framework\App\ResourceConnection; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\AbstractIndexer; | ||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\Indexer; | ||
|
||
/** | ||
* Categories data datasource resource model. | ||
|
@@ -26,7 +26,7 @@ | |
* @package Smile_ElasticSuiteCatalog | ||
* @author Aurelien FOUCRET <[email protected]> | ||
*/ | ||
class CategoryData extends AbstractIndexer | ||
class CategoryData extends Indexer | ||
{ | ||
/** | ||
* @var array Local cache for category names | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
use Magento\CatalogInventory\Api\StockRegistryInterface; | ||
use Magento\Framework\App\ResourceConnection; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\AbstractIndexer; | ||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\Indexer; | ||
|
||
/** | ||
* Catalog Inventory Data source resource model | ||
|
@@ -24,7 +24,7 @@ | |
* @package Smile_ElasticSuiteCatalog | ||
* @author Romain Ruaud <[email protected]> | ||
*/ | ||
class InventoryData extends AbstractIndexer | ||
class InventoryData extends Indexer | ||
{ | ||
/** | ||
* @var \Magento\CatalogInventory\Api\StockRegistryInterface | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
|
||
namespace Smile\ElasticSuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Datasource; | ||
|
||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\AbstractIndexer; | ||
use Smile\ElasticSuiteCatalog\Model\ResourceModel\Eav\Indexer\Indexer; | ||
|
||
/** | ||
* Prices data datasource resource model. | ||
|
@@ -23,7 +23,7 @@ | |
* @package Smile_ElasticSuiteCatalog | ||
* @author Aurelien FOUCRET <[email protected]> | ||
*/ | ||
class PriceData extends AbstractIndexer | ||
class PriceData extends Indexer | ||
{ | ||
/** | ||
* Load prices data for a list of product ids and a given store. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
|
||
namespace Smile\ElasticSuiteCatalog\Model\Eav\Indexer; | ||
namespace Smile\ElasticSuiteCore\Indexer; | ||
|
||
use Magento\Framework\Indexer\SaveHandler\IndexerInterface; | ||
use Smile\ElasticSuiteCore\Api\Index\IndexOperationInterface; | ||
|
@@ -24,8 +24,9 @@ | |
* @package Smile_ElasticSuiteCatalog | ||
* @author Aurelien FOUCRET <[email protected]> | ||
* @author Romain Ruaud <[email protected]> | ||
* @author Fanny DECLERCK <[email protected]> | ||
*/ | ||
class IndexerHandler implements IndexerInterface | ||
class GenericIndexerHandler implements IndexerInterface | ||
{ | ||
/** | ||
* @var \Smile\ElasticSuiteCore\Api\Index\IndexOperationInterface | ||
|
Oops, something went wrong.