@ EventMapping ( SearchConstants . SEARCH_RESULTS_QNAME_STRING ) public void handleSearchResult ( EventRequest request ) { // UP-3887 Design flaw. Both the searchLauncher portlet instance and the search portlet // instance receive // searchRequest and searchResult events because they are in the same portlet code base (to // share // autosuggest_handler.jsp and because we have to calculate the search portlet url for the // ajax call) // and share the portlet.xml which defines the event handling behavior. // If this instance is the searchLauncher, ignore the searchResult. The search was submitted // to the search // portlet instance. final String searchLaunchFname = request . getPreferences ( ) . getValue ( SEARCH_LAUNCH_FNAME , null ) ; if ( searchLaunchFname != null ) { // Noisy in debug mode so commenting out debug message // logger.debug("SearchLauncher does not process SearchResponse events so discarding // message"); return ; } final Event event = request . getEvent ( ) ; final SearchResults portletSearchResults = ( SearchResults ) event . getValue ( ) ; // get the existing portal search result from the session and append // the results for this event final String queryId = portletSearchResults . getQueryId ( ) ; final PortalSearchResults results = this . getPortalSearchResults ( request , queryId ) ; if ( results == null ) { this . logger . warn ( "No PortalSearchResults found for queryId {}, ignoring search results from {}" , queryId , getSearchResultsSource ( portletSearchResults ) ) ; return ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "For queryId {}, adding {} search results from {}" , queryId , portletSearchResults . getSearchResult ( ) . size ( ) , getSearchResultsSource ( portletSearchResults ) ) ; } final String windowId = portletSearchResults . getWindowId ( ) ; final HttpServletRequest httpServletRequest = this . portalRequestUtils . getPortletHttpRequest ( request ) ; final IPortletWindowId portletWindowId = this . portletWindowRegistry . getPortletWindowId ( httpServletRequest , windowId ) ; // Add the other portlet's results to the main search results object this . addSearchResults ( portletSearchResults , results , httpServletRequest , portletWindowId ) ; }
Handles all the SearchResults events coming back from portlets