public function getSuggestions(SearchRequest $searchRequest, array $additionalFilters = []) : array
    {
        $requestId = (int)$this->tsfe->getRequestedId();
        $groupList = (string)$this->tsfe->gr_list;

        $suggestQuery = $this->queryBuilder->buildSuggestQuery($searchRequest->getRawUserQuery(), $additionalFilters, $requestId, $groupList);
        $solrSuggestions = $this->getSolrSuggestions($suggestQuery);

        if ($solrSuggestions === []) {
            return ['status' => false];
        }

        $maxSuggestions = $this->typoScriptConfiguration->getSuggestNumberOfSuggestions();
        $showTopResults = $this->typoScriptConfiguration->getSuggestShowTopResults();
        $suggestions    = $this->getSuggestionArray($suggestQuery, $solrSuggestions, $maxSuggestions);

        if (!$showTopResults) {
            return $this->getResultArray($searchRequest, $suggestions, [], false);
        }

        return $this->addTopResultsToSuggestions($searchRequest, $suggestions, $additionalFilters);
    }
public function getSuggestions(SearchRequest $searchRequest, array $additionalFilters = []) : array
    {
        $requestId = (int)$this->tsfe->getRequestedId();
        $groupList = (string)$this->tsfe->gr_list;

        $suggestQuery = $this->queryBuilder->buildSuggestQuery($searchRequest->getRawUserQuery(), $additionalFilters, $requestId, $groupList);
        $solrSuggestions = $this->getSolrSuggestions($suggestQuery);

        if ($solrSuggestions === []) {
            return ['status' => false];
        }

        $maxSuggestions = $this->typoScriptConfiguration->getSuggestNumberOfSuggestions();
        $showTopResults = $this->typoScriptConfiguration->getSuggestShowTopResults();
        $suggestions    = $this->getSuggestionArray($suggestQuery, $solrSuggestions, $maxSuggestions);

        if (!$showTopResults) {
            return $this->getResultArray($searchRequest, $suggestions, [], false);
        }

        return $this->addTopResultsToSuggestions($searchRequest, $suggestions, $additionalFilters);
    }
public function getSuggestions ( SearchRequest $ searchRequest , array $ additionalFilters = [ ] ) : array { $ requestId = ( int ) $ this -> tsfe -> getRequestedId ( ) ; $ groupList = ( string ) $ this -> tsfe -> gr_list ; $ suggestQuery = $ this -> queryBuilder -> buildSuggestQuery ( $ searchRequest -> getRawUserQuery ( ) , $ additionalFilters , $ requestId , $ groupList ) ; $ solrSuggestions = $ this -> getSolrSuggestions ( $ suggestQuery ) ; if ( $ solrSuggestions === [ ] ) { return [ 'status' => false ] ; } $ maxSuggestions = $ this -> typoScriptConfiguration -> getSuggestNumberOfSuggestions ( ) ; $ showTopResults = $ this -> typoScriptConfiguration -> getSuggestShowTopResults ( ) ; $ suggestions = $ this -> getSuggestionArray ( $ suggestQuery , $ solrSuggestions , $ maxSuggestions ) ; if ( ! $ showTopResults ) { return $ this -> getResultArray ( $ searchRequest , $ suggestions , [ ] , false ) ; } return $ this -> addTopResultsToSuggestions ( $ searchRequest , $ suggestions , $ additionalFilters ) ; }
Build an array structure of the suggestions.

@param SearchRequest $searchRequest
@param array $additionalFilters
@return array
Build an array structure of the suggestions .