Skip to content

Commit

Permalink
#21772: Static test fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
p-bystritsky committed Apr 16, 2019
1 parent b34eb7a commit 3c50c7c
Showing 1 changed file with 22 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
use Magento\CatalogSearch\Model\Search\FilterMapper\VisibilityFilter;
use Magento\CatalogSearch\Model\Search\TableMapper;
use Magento\Customer\Model\Session;
use Magento\Eav\Model\Config;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\App\ObjectManager;
Expand All @@ -20,10 +22,11 @@
use Magento\Framework\Search\Adapter\Mysql\Filter\PreprocessorInterface;
use Magento\Framework\Search\Request\FilterInterface;
use Magento\Store\Model\Store;
use Magento\Customer\Model\Session;
use Magento\CatalogSearch\Model\Search\FilterMapper\VisibilityFilter;

/**
* ElasticSearch search filter pre-processor.
*
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @deprecated
* @see \Magento\ElasticSearch
Expand Down Expand Up @@ -128,18 +131,21 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function process(FilterInterface $filter, $isNegation, $query)
{
return $this->processQueryWithField($filter, $isNegation, $query);
}

/**
* Process query with field.
*
* @param FilterInterface $filter
* @param bool $isNegation
* @param string $query
* @return string
* @throws \Magento\Framework\Exception\LocalizedException
*/
private function processQueryWithField(FilterInterface $filter, $isNegation, $query)
{
Expand Down Expand Up @@ -204,19 +210,23 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
->where('main_table.store_id = ?', Store::DEFAULT_STORE_ID)
->having($query);

$resultQuery = 'search_index.entity_id IN (
select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter
)';
$resultQuery = 'search_index.entity_id IN ('
. 'select entity_id from '
. $this->conditionManager->wrapBrackets($select)
. ' as filter)';
}

return $resultQuery;
}

/**
* Process range numeric.
*
* @param FilterInterface $filter
* @param string $query
* @param Attribute $attribute
* @return string
* @throws \Exception
*/
private function processRangeNumeric(FilterInterface $filter, $query, $attribute)
{
Expand All @@ -238,14 +248,17 @@ private function processRangeNumeric(FilterInterface $filter, $query, $attribute
->where('main_table.store_id = ?', $currentStoreId)
->having($query);

$resultQuery = 'search_index.entity_id IN (
select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter
)';
$resultQuery = 'search_index.entity_id IN ('
. 'select entity_id from '
. $this->conditionManager->wrapBrackets($select)
. ' as filter)';

return $resultQuery;
}

/**
* Process term select.
*
* @param FilterInterface $filter
* @param bool $isNegation
* @return string
Expand Down

0 comments on commit 3c50c7c

Please sign in to comment.