public function create(
        $storeId,
        $containerName,
        $from,
        $size,
        $query = null,
        $sortOrders = [],
        $filters = [],
        $queryFilters = [],
        $facets = []
    ) {
        $containerConfig  = $this->getRequestContainerConfiguration($storeId, $containerName);
        $containerFilters = $this->getContainerFilters($containerConfig);
        $containerAggs    = $this->getContainerAggregations($containerConfig, $query, $filters, $queryFilters);

        $facets       = array_merge($facets, $containerAggs);
        $facetFilters = array_intersect_key($filters, $facets);
        $queryFilters = array_merge($queryFilters, $containerFilters, array_diff_key($filters, $facetFilters));

        $spellingType = SpellcheckerInterface::SPELLING_TYPE_EXACT;

        if ($query && is_string($query)) {
            $spellingType = $this->getSpellingType($containerConfig, $query);
        }

        $requestParams = [
            'name'         => $containerName,
            'indexName'    => $containerConfig->getIndexName(),
            'type'         => $containerConfig->getTypeName(),
            'from'         => $from,
            'size'         => $size,
            'dimensions'   => $this->buildDimensions($storeId),
            'query'        => $this->queryBuilder->createQuery($containerConfig, $query, $queryFilters, $spellingType),
            'sortOrders'   => $this->sortOrderBuilder->buildSordOrders($containerConfig, $sortOrders),
            'buckets'      => $this->aggregationBuilder->buildAggregations($containerConfig, $facets, $facetFilters),
            'spellingType' => $spellingType,
        ];

        if (!empty($facetFilters)) {
            $requestParams['filter'] = $this->queryBuilder->createFilterQuery($containerConfig, $facetFilters);
        }

        $request = $this->requestFactory->create($requestParams);

        return $request;
    }
public function create(
        $storeId,
        $containerName,
        $from,
        $size,
        $query = null,
        $sortOrders = [],
        $filters = [],
        $queryFilters = [],
        $facets = []
    ) {
        $containerConfig  = $this->getRequestContainerConfiguration($storeId, $containerName);
        $containerFilters = $this->getContainerFilters($containerConfig);
        $containerAggs    = $this->getContainerAggregations($containerConfig, $query, $filters, $queryFilters);

        $facets       = array_merge($facets, $containerAggs);
        $facetFilters = array_intersect_key($filters, $facets);
        $queryFilters = array_merge($queryFilters, $containerFilters, array_diff_key($filters, $facetFilters));

        $spellingType = SpellcheckerInterface::SPELLING_TYPE_EXACT;

        if ($query && is_string($query)) {
            $spellingType = $this->getSpellingType($containerConfig, $query);
        }

        $requestParams = [
            'name'         => $containerName,
            'indexName'    => $containerConfig->getIndexName(),
            'type'         => $containerConfig->getTypeName(),
            'from'         => $from,
            'size'         => $size,
            'dimensions'   => $this->buildDimensions($storeId),
            'query'        => $this->queryBuilder->createQuery($containerConfig, $query, $queryFilters, $spellingType),
            'sortOrders'   => $this->sortOrderBuilder->buildSordOrders($containerConfig, $sortOrders),
            'buckets'      => $this->aggregationBuilder->buildAggregations($containerConfig, $facets, $facetFilters),
            'spellingType' => $spellingType,
        ];

        if (!empty($facetFilters)) {
            $requestParams['filter'] = $this->queryBuilder->createFilterQuery($containerConfig, $facetFilters);
        }

        $request = $this->requestFactory->create($requestParams);

        return $request;
    }
public function create ( $ storeId , $ containerName , $ from , $ size , $ query = null , $ sortOrders = [ ] , $ filters = [ ] , $ queryFilters = [ ] , $ facets = [ ] ) { $ containerConfig = $ this -> getRequestContainerConfiguration ( $ storeId , $ containerName ) ; $ containerFilters = $ this -> getContainerFilters ( $ containerConfig ) ; $ containerAggs = $ this -> getContainerAggregations ( $ containerConfig , $ query , $ filters , $ queryFilters ) ; $ facets = array_merge ( $ facets , $ containerAggs ) ; $ facetFilters = array_intersect_key ( $ filters , $ facets ) ; $ queryFilters = array_merge ( $ queryFilters , $ containerFilters , array_diff_key ( $ filters , $ facetFilters ) ) ; $ spellingType = SpellcheckerInterface :: SPELLING_TYPE_EXACT ; if ( $ query && is_string ( $ query ) ) { $ spellingType = $ this -> getSpellingType ( $ containerConfig , $ query ) ; } $ requestParams = [ 'name' => $ containerName , 'indexName' => $ containerConfig -> getIndexName ( ) , 'type' => $ containerConfig -> getTypeName ( ) , 'from' => $ from , 'size' => $ size , 'dimensions' => $ this -> buildDimensions ( $ storeId ) , 'query' => $ this -> queryBuilder -> createQuery ( $ containerConfig , $ query , $ queryFilters , $ spellingType ) , 'sortOrders' => $ this -> sortOrderBuilder -> buildSordOrders ( $ containerConfig , $ sortOrders ) , 'buckets' => $ this -> aggregationBuilder -> buildAggregations ( $ containerConfig , $ facets , $ facetFilters ) , 'spellingType' => $ spellingType , ] ; if ( ! empty ( $ facetFilters ) ) { $ requestParams [ 'filter' ] = $ this -> queryBuilder -> createFilterQuery ( $ containerConfig , $ facetFilters ) ; } $ request = $ this -> requestFactory -> create ( $ requestParams ) ; return $ request ; }
Create a new search request.

@param integer               $storeId       Search request store id.
@param string                $containerName Search request name.
@param integer               $from          Search request pagination from clause.
@param integer               $size          Search request pagination size.
@param string|QueryInterface $query         Search request query.
@param array                 $sortOrders    Search request sort orders.
@param array                 $filters       Search request filters.
@param QueryInterface[]      $queryFilters  Search request filters prebuilt as QueryInterface.
@param array                 $facets        Search request facets.

@return RequestInterface
Create a new search request .