public function addFacet($field, $facetType, $facetConfig, $facetFilter = null) { $this->facets[$field] = ['type' => $facetType, 'filter' => $facetFilter, 'config' => $facetConfig]; return $this; }
/** * Append facets used to select suggested attributes. * * @return \Smile\ElasticsuiteCatalog\Model\Autocomplete\Product\Attribute\DataProvider */ private function prepareProductCollection() { foreach ($this->attributeCollection as $attribute) { $facetSize = $this->getResultsPageSize(); $filterField = $this->getFilterField($attribute); $this->productCollection->addFacet($filterField, BucketInterface::TYPE_TERM, ['size' => $facetSize]); } return $this; }