Author: Aurelien FOUCRET (aurelien.foucret@smile.fr)
コード例 #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);
 }
コード例 #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;
 }
コード例 #3
0
 /**
  * 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);
 }
コード例 #4
0
 /**
  * {@inheritDoc}
  */
 public function isAvailable()
 {
     return $this->indexOperation->isAvailable();
 }