Smile\ElasticsuiteCore\Helper\IndexSettings::getIndexAliasFromIdentifier PHP Method

getIndexAliasFromIdentifier() public method

Returns the index alias for an identifier (eg. catalog_product) by store.
public getIndexAliasFromIdentifier ( string $indexIdentifier, integer | string | Magento\Store\Api\Data\StoreInterface $store ) : string
$indexIdentifier string An index identifier.
$store integer | string | Magento\Store\Api\Data\StoreInterface The store.
return string
    public function getIndexAliasFromIdentifier($indexIdentifier, $store)
    {
        $store = $this->getStoreCode($store);
        return sprintf('%s_%s_%s', $this->getIndexAlias(), $store, $indexIdentifier);
    }

Usage Example

Example #1
0
 /**
  * Create the synonyms index for a store id.
  *
  * @param integer  $storeId    Store id.
  * @param string[] $synonyms   Raw synonyms list.
  * @param string[] $expansions Raw expansions list.
  *
  * @return void
  */
 public function reindex($storeId, $synonyms, $expansions)
 {
     $indexIdentifier = ThesaurusIndex::INDEX_IDENTIER;
     $indexName = $this->indexSettingsHelper->createIndexNameFromIdentifier($indexIdentifier, $storeId);
     $indexAlias = $this->indexSettingsHelper->getIndexAliasFromIdentifier($indexIdentifier, $storeId);
     $indexSettings = ['settings' => $this->getIndexSettings($synonyms, $expansions)];
     $this->client->indices()->create(['index' => $indexName, 'body' => $indexSettings]);
     $this->indexManager->proceedIndexInstall($indexName, $indexAlias);
     $this->cacheHelper->cleanIndexCache(ThesaurusIndex::INDEX_IDENTIER, $storeId);
 }
All Usage Examples Of Smile\ElasticsuiteCore\Helper\IndexSettings::getIndexAliasFromIdentifier