public function suggestAction($queryString, $callback, $additionalFilters = [])
    {
        $jsonPCallback = htmlspecialchars($callback);
        // Get suggestions
        $rawQuery = htmlspecialchars(mb_strtolower(trim($queryString)));

        try {
            /** @var SuggestService $suggestService */
            $suggestService = GeneralUtility::makeInstance(
                SuggestService::class,
                /** @scrutinizer ignore-type */ $this->typoScriptFrontendController,
                /** @scrutinizer ignore-type */ $this->searchService,
                /** @scrutinizer ignore-type */ $this->typoScriptConfiguration);

            $additionalFilters = is_array($additionalFilters) ? array_map("htmlspecialchars", $additionalFilters) : [];
            $pageId = $this->typoScriptFrontendController->getRequestedId();
            $languageId = $this->typoScriptFrontendController->sys_language_uid;
            $arguments = (array)$this->request->getArguments();

            $searchRequest = $this->getSearchRequestBuilder()->buildForSuggest($arguments, $rawQuery, $pageId, $languageId);
            $result = $suggestService->getSuggestions($searchRequest, $additionalFilters);
        } catch (SolrUnavailableException $e) {
            $this->handleSolrUnavailable();
            $result = ['status' => false];
        }

        return htmlspecialchars($jsonPCallback) . '(' . json_encode($result) . ')';
    }
public function suggestAction($queryString, $callback, $additionalFilters = [])
    {
        $jsonPCallback = htmlspecialchars($callback);
        // Get suggestions
        $rawQuery = htmlspecialchars(mb_strtolower(trim($queryString)));

        try {
            /** @var SuggestService $suggestService */
            $suggestService = GeneralUtility::makeInstance(
                SuggestService::class,
                /** @scrutinizer ignore-type */ $this->typoScriptFrontendController,
                /** @scrutinizer ignore-type */ $this->searchService,
                /** @scrutinizer ignore-type */ $this->typoScriptConfiguration);

            $additionalFilters = is_array($additionalFilters) ? array_map("htmlspecialchars", $additionalFilters) : [];
            $pageId = $this->typoScriptFrontendController->getRequestedId();
            $languageId = $this->typoScriptFrontendController->sys_language_uid;
            $arguments = (array)$this->request->getArguments();

            $searchRequest = $this->getSearchRequestBuilder()->buildForSuggest($arguments, $rawQuery, $pageId, $languageId);
            $result = $suggestService->getSuggestions($searchRequest, $additionalFilters);
        } catch (SolrUnavailableException $e) {
            $this->handleSolrUnavailable();
            $result = ['status' => false];
        }

        return htmlspecialchars($jsonPCallback) . '(' . json_encode($result) . ')';
    }
public function suggestAction ( $ queryString , $ callback , $ additionalFilters = [ ] ) { $ jsonPCallback = htmlspecialchars ( $ callback ) ; // Get suggestions $ rawQuery = htmlspecialchars ( mb_strtolower ( trim ( $ queryString ) ) ) ; try { /** @var SuggestService $suggestService */ $ suggestService = GeneralUtility :: makeInstance ( SuggestService :: class , /** @scrutinizer ignore-type */ $ this -> typoScriptFrontendController , /** @scrutinizer ignore-type */ $ this -> searchService , /** @scrutinizer ignore-type */ $ this -> typoScriptConfiguration ) ; $ additionalFilters = is_array ( $ additionalFilters ) ? array_map ( "htmlspecialchars" , $ additionalFilters ) : [ ] ; $ pageId = $ this -> typoScriptFrontendController -> getRequestedId ( ) ; $ languageId = $ this -> typoScriptFrontendController -> sys_language_uid ; $ arguments = ( array ) $ this -> request -> getArguments ( ) ; $ searchRequest = $ this -> getSearchRequestBuilder ( ) -> buildForSuggest ( $ arguments , $ rawQuery , $ pageId , $ languageId ) ; $ result = $ suggestService -> getSuggestions ( $ searchRequest , $ additionalFilters ) ; } catch ( SolrUnavailableException $ e ) { $ this -> handleSolrUnavailable ( ) ; $ result = [ 'status' => false ] ; } return htmlspecialchars ( $ jsonPCallback ) . '(' . json_encode ( $ result ) . ')' ; }
This method creates a suggest json response that can be used in a suggest layer.

@param string $queryString
@param string $callback
@param array $additionalFilters
@return string
This method creates a suggest json response that can be used in a suggest layer .