@@ -380,7 +380,7 @@ public function updateIndexMapping(int $storeId, string $mappedIndexerId): self
380
380
$ indexName ,
381
381
$ this ->clientConfig ->getEntityType ()
382
382
);
383
- $ this ->setMappedAttributes ($ attrToUpdate );
383
+ $ this ->setMappedAttributes ($ indexName , $ attrToUpdate );
384
384
}
385
385
386
386
return $ this ;
@@ -395,7 +395,7 @@ public function updateIndexMapping(int $storeId, string $mappedIndexerId): self
395
395
*/
396
396
private function getIndexFromAlias (int $ storeId , string $ mappedIndexerId ): string
397
397
{
398
- $ indexCode = $ mappedIndexerId . $ storeId ;
398
+ $ indexCode = $ mappedIndexerId . ' _ ' . $ storeId ;
399
399
if (!isset ($ this ->indexByCode [$ indexCode ])) {
400
400
$ this ->indexByCode [$ indexCode ] = $ this ->indexNameResolver ->getIndexFromAlias ($ storeId , $ mappedIndexerId );
401
401
}
@@ -411,25 +411,26 @@ private function getIndexFromAlias(int $storeId, string $mappedIndexerId): strin
411
411
*/
412
412
private function getMappedAttributes (string $ indexName ): array
413
413
{
414
- if (empty ($ this ->mappedAttributes )) {
414
+ if (empty ($ this ->mappedAttributes [ $ indexName ] )) {
415
415
$ mappedAttributes = $ this ->client ->getMapping (['index ' => $ indexName ]);
416
416
$ pathField = $ this ->arrayManager ->findPath ('properties ' , $ mappedAttributes );
417
- $ this ->mappedAttributes = $ this ->arrayManager ->get ($ pathField , $ mappedAttributes , []);
417
+ $ this ->mappedAttributes [ $ indexName ] = $ this ->arrayManager ->get ($ pathField , $ mappedAttributes , []);
418
418
}
419
419
420
- return $ this ->mappedAttributes ;
420
+ return $ this ->mappedAttributes [ $ indexName ] ;
421
421
}
422
422
423
423
/**
424
424
* Set mapped attributes to cache.
425
425
*
426
+ * @param string $indexName
426
427
* @param array $mappedAttributes
427
428
* @return $this
428
429
*/
429
- private function setMappedAttributes (array $ mappedAttributes ): self
430
+ private function setMappedAttributes (string $ indexName , array $ mappedAttributes ): self
430
431
{
431
432
foreach ($ mappedAttributes as $ attributeCode => $ attributeParams ) {
432
- $ this ->mappedAttributes [$ attributeCode ] = $ attributeParams ;
433
+ $ this ->mappedAttributes [$ indexName ][ $ attributeCode ] = $ attributeParams ;
433
434
}
434
435
435
436
return $ this ;
0 commit comments