private function getSearchQueryIdentities()
    {
        $identities = [];
        $queryIds   = [];
        $origData   = $this->optimizer->getOrigData();
        $data       = $this->optimizer->getData();

        // If optimizer was previously assigned to all queries, or is now set to all queries.
        $isAppliedToAllQueries = empty($data['quick_search_container'])
            || (bool) $data['quick_search_container']['apply_to'] === false;
        $wasAppliedToAllQueries = empty($origData['quick_search_container']['query_ids']);

        if (!empty($origData['quick_search_container']['query_ids'])) {
            $queryIds = array_merge($queryIds, $origData['quick_search_container']['query_ids']);
        }

        if (!empty($data['quick_search_container']['query_ids'])) {
            foreach ($data['quick_search_container']['query_ids'] as $query) {
                $queryIds[] = $query['id'];
            }
        }

        $queryIds = array_unique(array_filter($queryIds));

        if ($wasAppliedToAllQueries || $isAppliedToAllQueries) {
            $identities[] = \Smile\ElasticsuiteCatalog\Block\CatalogSearch\Result\Cache::POPULAR_SEARCH_CACHE_TAG;
        } elseif (!empty($queryIds)) {
            $popularQueryIds = $this->queryCollection
                ->setPopularQueryFilter($this->optimizer->getStoreId())
                ->setPageSize($this->getMaxCountCacheableSearchTerms($this->optimizer->getStoreId()))
                ->load()
                ->getColumnValues('query_id');

            if (!empty(array_intersect($queryIds, $popularQueryIds))) {
                $identities[] = \Smile\ElasticsuiteCatalog\Block\CatalogSearch\Result\Cache::POPULAR_SEARCH_CACHE_TAG;
            }
        }

        return $identities;
    }