Smile\ElasticsuiteCatalogRule\Model\Rule\Condition\Combine::getSearchQuery PHP Метод

getSearchQuery() публичный Метод

Build a search query for the current rule.
public getSearchQuery ( ) : Smile\ElasticsuiteCore\Search\Request\QueryInterface
Результат Smile\ElasticsuiteCore\Search\Request\QueryInterface
    public function getSearchQuery()
    {
        $queryParams = [];
        $aggregator = $this->getAggregator();
        $value = (bool) $this->getValue();
        $queryClause = $aggregator === 'all' ? 'must' : 'should';
        foreach ($this->getConditions() as $condition) {
            $subQuery = $condition->getSearchQuery();
            if ($subQuery !== null && $subQuery instanceof QueryInterface) {
                if ($value === false) {
                    $subQuery = $this->queryFactory->create(QueryInterface::TYPE_NOT, ['query' => $subQuery]);
                }
                $queryParams[$queryClause][] = $subQuery;
            }
        }
        $query = $this->queryFactory->create(QueryInterface::TYPE_BOOL, $queryParams);
        return $query;
    }