searchRequest = $searchRequest; } protected function getPreloadData() { $urlBuilder = new TopItemsUrlBuilder(); $urlBuilder ->setSearchTypes([ [FulltextLuigisBox::INDEX_PRODUCTS], [FulltextLuigisBox::INDEX_SECTIONS], [FulltextLuigisBox::INDEX_PRODUCERS], ]); $searchResponse = $this->searchRequest->search($urlBuilder); $typesIds = []; foreach ($searchResponse['hits'] ?? [] as $result) { $type = $result['type'] ?? false; $id = $result['attributes']['item_group_id'][0] ?? $result['attributes']['id'][0] ?? $result['attributes']['identity'][0] ?? $result['attributes']['original_url'] ?? false; if ($type && $id) { $typesIds[$type][] = (int) $id; } } $typesMap = array_flip(FulltextLuigisBox::LB_TYPES); $vars = []; foreach ($typesIds as $type => $ids) { $type = $typesMap[$type] ?? ''; $method = 'preload'.ucfirst($type); if (method_exists($this, $method)) { $vars[$type] = $this->{$method}($ids ?? []); } } return $vars; } }