Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
IndexStructure.php
Go to the documentation of this file.
1 <?php
7 
9 use Magento\Elasticsearch\Model\Adapter\Elasticsearch as ElasticsearchAdapter;
11 
13 {
17  private $adapter;
18 
22  private $scopeResolver;
23 
28  public function __construct(
29  ElasticsearchAdapter $adapter,
30  ScopeResolverInterface $scopeResolver
31  ) {
32  $this->adapter = $adapter;
33  $this->scopeResolver = $scopeResolver;
34  }
35 
39  public function delete(
40  $indexerId,
41  array $dimensions = []
42  ) {
43  $dimension = current($dimensions);
44  $scopeId = $this->scopeResolver->getScope($dimension->getValue())->getId();
45  $this->adapter->cleanIndex($scopeId, $indexerId);
46  }
47 
52  public function create(
53  $indexerId,
54  array $fields,
55  array $dimensions = []
56  ) {
57  $dimension = current($dimensions);
58  $scopeId = $this->scopeResolver->getScope($dimension->getValue())->getId();
59  $this->adapter->checkIndex($scopeId, $indexerId, false);
60  }
61 }
$fields
Definition: details.phtml:14
$adapter
Definition: webapi_user.php:16
create( $indexerId, array $fields, array $dimensions=[])
__construct(ElasticsearchAdapter $adapter, ScopeResolverInterface $scopeResolver)