protected function getFrequentSearchTermsFromStatistics(array $frequentSearchConfiguration) : array
    {
        $terms = [];

        if ($frequentSearchConfiguration['select.']['checkRootPageId']) {
            $checkRootPidWhere = 'root_pid = ' . $this->tsfe->tmpl->rootLine[0]['uid'];
        } else {
            $checkRootPidWhere = '1';
        }
        if ($frequentSearchConfiguration['select.']['checkLanguage']) {
            $checkLanguageWhere = ' AND language =' . $this->tsfe->sys_language_uid;
        } else {
            $checkLanguageWhere = '';
        }

        $frequentSearchConfiguration['select.']['ADD_WHERE'] = $checkRootPidWhere .
            $checkLanguageWhere . ' ' .
            $frequentSearchConfiguration['select.']['ADD_WHERE'];

        $frequentSearchTerms = $this->statisticsRepository->getFrequentSearchTermsFromStatisticsByFrequentSearchConfiguration($frequentSearchConfiguration);

        if (!is_array($frequentSearchTerms)) {
            return $terms;
        }

        foreach ($frequentSearchTerms as $term) {
            $cleanedTerm = html_entity_decode($term['search_term'], ENT_QUOTES, 'UTF-8');
            $terms[$cleanedTerm] = $term['hits'];
        }

        return $terms;
    }
protected function getFrequentSearchTermsFromStatistics(array $frequentSearchConfiguration) : array
    {
        $terms = [];

        if ($frequentSearchConfiguration['select.']['checkRootPageId']) {
            $checkRootPidWhere = 'root_pid = ' . $this->tsfe->tmpl->rootLine[0]['uid'];
        } else {
            $checkRootPidWhere = '1';
        }
        if ($frequentSearchConfiguration['select.']['checkLanguage']) {
            $checkLanguageWhere = ' AND language =' . $this->tsfe->sys_language_uid;
        } else {
            $checkLanguageWhere = '';
        }

        $frequentSearchConfiguration['select.']['ADD_WHERE'] = $checkRootPidWhere .
            $checkLanguageWhere . ' ' .
            $frequentSearchConfiguration['select.']['ADD_WHERE'];

        $frequentSearchTerms = $this->statisticsRepository->getFrequentSearchTermsFromStatisticsByFrequentSearchConfiguration($frequentSearchConfiguration);

        if (!is_array($frequentSearchTerms)) {
            return $terms;
        }

        foreach ($frequentSearchTerms as $term) {
            $cleanedTerm = html_entity_decode($term['search_term'], ENT_QUOTES, 'UTF-8');
            $terms[$cleanedTerm] = $term['hits'];
        }

        return $terms;
    }
protected function getFrequentSearchTermsFromStatistics ( array $ frequentSearchConfiguration ) : array { $ terms = [ ] ; if ( $ frequentSearchConfiguration [ 'select.' ] [ 'checkRootPageId' ] ) { $ checkRootPidWhere = 'root_pid = ' . $ this -> tsfe -> tmpl -> rootLine [ 0 ] [ 'uid' ] ; } else { $ checkRootPidWhere = '1' ; } if ( $ frequentSearchConfiguration [ 'select.' ] [ 'checkLanguage' ] ) { $ checkLanguageWhere = ' AND language =' . $ this -> tsfe -> sys_language_uid ; } else { $ checkLanguageWhere = '' ; } $ frequentSearchConfiguration [ 'select.' ] [ 'ADD_WHERE' ] = $ checkRootPidWhere . $ checkLanguageWhere . ' ' . $ frequentSearchConfiguration [ 'select.' ] [ 'ADD_WHERE' ] ; $ frequentSearchTerms = $ this -> statisticsRepository -> getFrequentSearchTermsFromStatisticsByFrequentSearchConfiguration ( $ frequentSearchConfiguration ) ; if ( ! is_array ( $ frequentSearchTerms ) ) { return $ terms ; } foreach ( $ frequentSearchTerms as $ term ) { $ cleanedTerm = html_entity_decode ( $ term [ 'search_term' ] , ENT_QUOTES , 'UTF-8' ) ; $ terms [ $ cleanedTerm ] = $ term [ 'hits' ] ; } return $ terms ; }
Gets frequent search terms from the statistics tracking table.

@param array $frequentSearchConfiguration
@return array Array of frequent search terms, keys are the terms, values are hits
Gets frequent search terms from the statistics tracking table .