0

In Magento 2.3.3, I added Rating filter in layered navigation. It's proper working when configuration is :

Store -> Configuration -> Catalog -> Catalog -> Catalog search ->Search Engine = MySQL

But, When I set Elasticsearch 5.0+ It's not display in layered navigation. I didn't get bucket value in collection. It's return blank array.

[rating_summary_bucket] => Magento\Framework\Search\Response\Bucket Object
        (
            [name:protected] => rating_summary_bucket
            [values:protected] => Array
                (
                )

        )

Function Code :

public function getFacetedData($field)
    {
        $this->_renderFilters();
        $result = [];
        $aggregations = $this->searchResult->getAggregations();
        // This behavior is for case with empty object when we got EmptyRequestDataException
        if (null !== $aggregations) {
            $bucket = $aggregations->getBucket($field . RequestGenerator::BUCKET_SUFFIX);
            if ($bucket) {
                //$bucket->getValues() return null
                foreach ($bucket->getValues() as $value) {
                    $metrics = $value->getMetrics();
                    $result[$metrics['value']] = $metrics;
                }
            } else {
                throw new StateException(__("The bucket doesn't exist."));
            }
        }
        return $result;
    }

How can I run rating filter with elasticsearch enable?

Any help would be appreciated.

Thanks !!

  • what theme are you using? does the layered navigation work in default luma theme? – paj Jan 22 at 21:25
  • Yes. It's luma theme. I didn't use third party. – Rohan Hapani Jan 23 at 4:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.