Пример #1
0
 /**
  * @param \Generated\Shared\Transfer\FacetConfigTransfer $facetConfigTransfer
  *
  * @return \Spryker\Client\Search\Model\Elasticsearch\Aggregation\FacetAggregationInterface
  */
 protected function createByFacetType(FacetConfigTransfer $facetConfigTransfer)
 {
     switch ($facetConfigTransfer->getType()) {
         case FacetConfigBuilder::TYPE_CATEGORY:
             return $this->createCategoryFacetAggregation($facetConfigTransfer);
         default:
             return $this->createByFacetValueType($facetConfigTransfer);
     }
 }
 /**
  * @param \Generated\Shared\Transfer\FacetConfigTransfer $facetConfigTransfer
  *
  * @return \Spryker\Client\Search\Model\Elasticsearch\AggregationExtractor\AggregationExtractorInterface
  */
 protected function createByType(FacetConfigTransfer $facetConfigTransfer)
 {
     switch ($facetConfigTransfer->getType()) {
         case FacetConfigBuilder::TYPE_RANGE:
         case FacetConfigBuilder::TYPE_PRICE_RANGE:
             return $this->createRangeExtractor($facetConfigTransfer);
         case FacetConfigBuilder::TYPE_CATEGORY:
             return $this->createCategoryExtractor($facetConfigTransfer);
         default:
             return $this->createFacetExtractor($facetConfigTransfer);
     }
 }
Пример #3
0
 /**
  * @param \Generated\Shared\Transfer\FacetConfigTransfer $facetConfigTransfer
  * @param mixed $filterValue
  *
  * @return \Elastica\Query\AbstractQuery|null
  */
 protected function createByFacetType(FacetConfigTransfer $facetConfigTransfer, $filterValue)
 {
     switch ($facetConfigTransfer->getType()) {
         case FacetConfigBuilder::TYPE_RANGE:
             return $this->createNestedRangeQuery($facetConfigTransfer, $filterValue)->createNestedQuery();
         case FacetConfigBuilder::TYPE_PRICE_RANGE:
             return $this->createNestedPriceRangeQuery($facetConfigTransfer, $filterValue)->createNestedQuery();
         case FacetConfigBuilder::TYPE_CATEGORY:
             return $this->createTermQuery($facetConfigTransfer, $filterValue);
         default:
             return null;
     }
 }