Skip to content

Commit

Permalink
Rework attribute filter model to be compatible with latest Elasticsuite.
Browse files Browse the repository at this point in the history
  • Loading branch information
romainruaud committed Mar 5, 2019
1 parent 7ac829a commit 29780ee
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Model/Layer/Filter/Rating.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ class Rating extends \Smile\ElasticsuiteCatalog\Model\Layer\Filter\Attribute
*/
public function addFacetToCollection($config = [])
{
$facetField = $this->getFilterField();
$facetType = \Smile\ElasticsuiteCore\Search\Request\BucketInterface::TYPE_HISTOGRAM;
$facetConfig = ['minDocCount' => 1, 'interval' => (int) self::RATING_AGG_INTERVAL];
$facetConfig = [
'name' => $this->getFilterField(),
'type' => \Smile\ElasticsuiteCore\Search\Request\BucketInterface::TYPE_HISTOGRAM,
'minDocCount' => 1,
'interval' => (int) self::RATING_AGG_INTERVAL
];

/** @var \Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection $productCollection */
$productCollection = $this->getLayer()->getProductCollection();
$productCollection->addFacet($facetField, $facetType, $facetConfig);
$productCollection->addFacet($facetConfig);

return $this;
}
Expand Down

0 comments on commit 29780ee

Please sign in to comment.