createRangeFacet example

$stats = $query->execute()->fetch(PDO::FETCH_ASSOC);

        $results = [];
        foreach ($criteria->getFacets() as $criteriaFacet) {
            if (!$criteriaFacet instanceof WeightFacet
                && !$criteriaFacet instanceof WidthFacet
                && !$criteriaFacet instanceof LengthFacet
                && !$criteriaFacet instanceof HeightFacet
            ) {
                continue;
            }
            $facetResult = $this->createRangeFacet($criteriaFacet$stats$criteria);
            if ($facetResult === null) {
                continue;
            }

            $results[] = $facetResult;
        }
        $criteria->addAttribute('product_dimensions_handled', new Attribute());

        return $results;
    }

    
&& !$criteriaFacet instanceof HeightFacet
            ) {
                continue;
            }

            if (!\array_key_exists($criteriaFacet->getName()$elasticResult['aggregations'])) {
                continue;
            }

            $data = $elasticResult['aggregations'][$criteriaFacet->getName()];

            $facetResult = $this->createRangeFacet($criteriaFacet$data$criteria);
            if (!$facetResult) {
                continue;
            }

            $result->addFacet($facetResult);
        }
    }

    /** * @param WeightFacet|WidthFacet|LengthFacet|HeightFacet $facet * @param array<string, string> $stats */
Home | Imprint | This part of the site doesn't use cookies.