Author: Aurelien FOUCRET (aurelien.foucret@smile.fr)
Exemplo n.º 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);
 }
Exemplo n.º 2
0
 /**
  * Retrieve the search engine mapping.
  *
  * @return MappingInterface
  */
 private function getMapping()
 {
     if ($this->mapping === null) {
         $defaultStore = $this->storeManager->getDefaultStoreView();
         $index = $this->indexManager->getIndexByName($this->indexName, $defaultStore);
         $this->mapping = $index->getType($this->typeName)->getMapping();
     }
     return $this->mapping;
 }
 /**
  * Retrieve the index associated with the currrent search request container.
  *
  * @return IndexInterface
  */
 private function getIndex()
 {
     $indexName = $this->readBaseConfigParam('index');
     return $this->indexManager->getIndexByName($indexName, $this->storeId);
 }
 /**
  * {@inheritDoc}
  */
 public function isAvailable()
 {
     return $this->indexOperation->isAvailable();
 }