Skip to content

Commit 01450cb

Browse files
committed
MC-31304: [ElasticSearch] Exception on catalog search result page
1 parent 7901014 commit 01450cb

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

app/code/Magento/Elasticsearch/Model/Adapter/Elasticsearch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public function updateIndexMapping(int $storeId, string $mappedIndexerId): self
361361

362362
$mappedAttributes = $this->client->getMapping(['index' => $indexName]);
363363
$pathField = $this->arrayManager->findPath('properties', $mappedAttributes);
364-
$mappedAttributes = $this->arrayManager->get($pathField, $mappedAttributes, $allAttributeTypes);
364+
$mappedAttributes = $this->arrayManager->get($pathField, $mappedAttributes, []);
365365

366366
$settings['index']['mapping']['total_fields']['limit'] = $this->getMappingTotalFieldsLimit($allAttributeTypes);
367367
$this->client->putIndexSettings($indexName, ['settings' => $settings]);

app/code/Magento/Elasticsearch/Model/Config.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Config implements ClientOptionsInterface
4545
protected $scopeConfig;
4646

4747
/**
48-
* @var string|null
48+
* @var string
4949
*/
5050
private $prefix;
5151

@@ -83,7 +83,7 @@ public function __construct(
8383
$this->scopeConfig = $scopeConfig;
8484
$this->clientResolver = $clientResolver;
8585
$this->engineResolver = $engineResolver;
86-
$this->prefix = $prefix;
86+
$this->prefix = $prefix ?: $this->clientResolver->getCurrentEngine();
8787
$this->engineList = $engineList;
8888
}
8989

@@ -101,7 +101,7 @@ public function prepareClientOptions($options = [])
101101
'enableAuth' => $this->getElasticsearchConfigData('enable_auth'),
102102
'username' => $this->getElasticsearchConfigData('username'),
103103
'password' => $this->getElasticsearchConfigData('password'),
104-
'timeout' => $this->getElasticsearchConfigData('server_timeout') ?: self::ELASTICSEARCH_DEFAULT_TIMEOUT,
104+
'timeout' => $this->getElasticsearchConfigData('server_timeout') ? : self::ELASTICSEARCH_DEFAULT_TIMEOUT,
105105
];
106106
$options = array_merge($defaultOptions, $options);
107107
$allowedOptions = array_merge(array_keys($defaultOptions), ['engine']);
@@ -125,9 +125,7 @@ function (string $key) use ($allowedOptions) {
125125
*/
126126
public function getElasticsearchConfigData($field, $storeId = null)
127127
{
128-
$searchEngine = $this->prefix ?: $this->clientResolver->getCurrentEngine();
129-
130-
return $this->getSearchConfigData($searchEngine . '_' . $field, $storeId);
128+
return $this->getSearchConfigData($this->prefix . '_' . $field, $storeId);
131129
}
132130

133131
/**

app/code/Magento/Elasticsearch/Model/Indexer/IndexerHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function isAvailable($dimensions = [])
142142
public function updateIndex(array $dimensions): IndexerInterface
143143
{
144144
$dimension = current($dimensions);
145-
$scopeId = $this->scopeResolver->getScope($dimension->getValue())->getId();
145+
$scopeId = (int)$this->scopeResolver->getScope($dimension->getValue())->getId();
146146
$this->adapter->updateIndexMapping($scopeId, $this->getIndexerId());
147147

148148
return $this;

0 commit comments

Comments
 (0)