Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 protected function _renderFiltersBefore()
 {
     $this->requestBuilder->bindDimension('scope', $this->getStoreId());
     if ($this->queryText) {
         $this->requestBuilder->bind('search_term', $this->queryText);
     }
     $priceRangeCalculation = $this->_scopeConfig->getValue(\Magento\Catalog\Model\Layer\Filter\Dynamic\AlgorithmFactory::XML_PATH_RANGE_CALCULATION, \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
     if ($priceRangeCalculation) {
         $this->requestBuilder->bind('price_dynamic_algorithm', $priceRangeCalculation);
     }
     $this->requestBuilder->setRequestName($this->searchRequestName);
     $queryRequest = $this->requestBuilder->create();
     $this->queryResponse = $this->searchEngine->search($queryRequest);
     $temporaryStorage = $this->temporaryStorageFactory->create();
     $table = $temporaryStorage->storeDocuments($this->queryResponse->getIterator());
     $this->getSelect()->joinInner(['search_result' => $table->getName()], 'e.entity_id = search_result.' . TemporaryStorage::FIELD_ENTITY_ID, []);
     $this->_totalRecords = $this->queryResponse->count();
     if ($this->order && 'relevance' === $this->order['field']) {
         $this->getSelect()->order('search_result.' . TemporaryStorage::FIELD_SCORE . ' ' . $this->order['dir']);
     }
     return parent::_renderFiltersBefore();
 }