Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection::loadProductCounts PHP Method

loadProductCounts() private method

Load product count : - collection size - number of products by attribute set
private loadProductCounts ( ) : void
return void
    private function loadProductCounts()
    {
        $storeId = $this->getStoreId();
        $requestName = $this->searchRequestName;
        // Query text.
        $queryText = $this->queryText;
        $setIdFacet = ['attribute_set_id' => ['type' => BucketInterface::TYPE_TERM, 'config' => ['size' => 0]]];
        $searchRequest = $this->requestBuilder->create($storeId, $requestName, 0, 0, $queryText, [], $this->filters, $this->queryFilters, $setIdFacet);
        $searchResponse = $this->searchEngine->search($searchRequest);
        $this->_totalRecords = $searchResponse->count();
        $this->countByAttributeSet = [];
        $this->isSpellchecked = $searchRequest->isSpellchecked();
        $bucket = $searchResponse->getAggregations()->getBucket('attribute_set_id');
        if ($bucket) {
            foreach ($bucket->getValues() as $value) {
                $metrics = $value->getMetrics();
                $this->countByAttributeSet[$metrics['value']] = $metrics['count'];
            }
        }
    }