@RequestMapping(params = {"query", "queryId"})
    public ModelAndView showSearchResults(
            PortletRequest request,
            @RequestParam(value = "query") String query,
            @RequestParam(value = "queryId") String queryId) {

        final Map<String, Object> model = new HashMap<>();
        model.put("query", query);

        // Determine if the new REST search should be used
        if (isRestSearch(request)) {
            // we only need query, so the model at this point is sufficient
            return new ModelAndView("/jsp/Search/searchRest", model);
        }

        ConcurrentMap<String, List<Tuple<SearchResult, String>>> results =
                new ConcurrentHashMap<>();
        final PortalSearchResults portalSearchResults =
                this.getPortalSearchResults(request, queryId);
        if (portalSearchResults != null) {
            results = portalSearchResults.getResults();
        }

        results.forEach(
                (key, value) -> {
                    value.sort(Comparator.comparingInt(tuple -> tuple.first.getRank()));
                });

        logger.debug("Search results for query '{}' are:  {}", query, results);

        model.put("results", results);
        model.put("defaultTabKey", this.defaultTabKey);
        model.put("tabKeys", this.tabKeys);

        final boolean isMobile = isMobile(request);
        String viewName = isMobile ? "/jsp/Search/mobileSearch" : "/jsp/Search/search";

        return new ModelAndView(viewName, model);
    }
@ RequestMapping ( params = { "query" , "queryId" } ) public ModelAndView showSearchResults ( PortletRequest request , @ RequestParam ( value = "query" ) String query , @ RequestParam ( value = "queryId" ) String queryId ) { final Map < String , Object > model = new HashMap < > ( ) ; model . put ( "query" , query ) ; if ( isRestSearch ( request ) ) { return new ModelAndView ( "/jsp/Search/searchRest" , model ) ; } ConcurrentMap < String , List < Tuple < SearchResult , String > > > results = new ConcurrentHashMap < > ( ) ; final PortalSearchResults portalSearchResults = this . getPortalSearchResults ( request , queryId ) ; if ( portalSearchResults != null ) { results = portalSearchResults . getResults ( ) ; } results . forEach ( ( key , value ) -> { value . sort ( Comparator . comparingInt ( tuple -> tuple . first . getRank ( ) ) ) ; } ) ; logger . debug ( "Search results for query '{}' are:  {}" , query , results ) ; model . put ( "results" , results ) ; model . put ( "defaultTabKey" , this . defaultTabKey ) ; model . put ( "tabKeys" , this . tabKeys ) ; final boolean isMobile = isMobile ( request ) ; String viewName = isMobile ? "/jsp/Search/mobileSearch" : "/jsp/Search/search" ; return new ModelAndView ( viewName , model ) ; }
Display search results