getStoreId() public method

Current container store id.
public getStoreId ( ) : integer
return integer
Example #1
0
 /**
  * Rewrite the query.
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  *
  * @param QueryBuilder                    $subject         Original query builder.
  * @param \Closure                        $proceed         Original create func.
  * @param ContainerConfigurationInterface $containerConfig Search request container config.
  * @param string                          $queryText       Current query text.
  * @param string                          $spellingType    Spelling type of the query.
  * @param float                           $boost           Original query boost.
  *
  * @return QueryInterface
  */
 public function aroundCreate(QueryBuilder $subject, \Closure $proceed, ContainerConfigurationInterface $containerConfig, $queryText, $spellingType, $boost = 1)
 {
     $storeId = $containerConfig->getStoreId();
     $requestName = $containerConfig->getName();
     $rewriteCacheKey = $requestName . '|' . $storeId . '|' . md5(json_encode($queryText));
     if (!isset($this->rewritesCache[$rewriteCacheKey])) {
         $query = $proceed($containerConfig, $queryText, $spellingType, $boost);
         $rewrites = [];
         if (!is_array($queryText)) {
             $queryText = [$queryText];
         }
         foreach ($queryText as $currentQueryText) {
             $rewrites = array_merge($rewrites, $this->index->getQueryRewrites($containerConfig, $currentQueryText));
         }
         if (!empty($rewrites)) {
             $synonymQueries = [$query];
             $synonymQueriesSpellcheck = SpellcheckerInterface::SPELLING_TYPE_EXACT;
             foreach ($rewrites as $rewrittenQuery => $weight) {
                 $synonymQueries[] = $proceed($containerConfig, $rewrittenQuery, $synonymQueriesSpellcheck, $weight);
             }
             $query = $this->queryFactory->create(QueryInterface::TYPE_BOOL, ['should' => $synonymQueries]);
         }
         $this->rewritesCache[$rewriteCacheKey] = $query;
     }
     return $this->rewritesCache[$rewriteCacheKey];
 }
Example #2
0
 /**
  * Load the thesaurus config for the current container.
  *
  * @param ContainerConfigurationInterface $containerConfig Search request container config.
  *
  * @return ThesaurusConfig
  */
 private function getConfig(ContainerConfigurationInterface $containerConfig)
 {
     $storeId = $containerConfig->getStoreId();
     $containerName = $containerConfig->getName();
     return $this->thesaurusConfigFactory->create($storeId, $containerName);
 }