Fórumok

Search results URLs are a random page in the portal

thumbnail
Brian Scott Schupbach, módosítva 11 év-val korábban

Search results URLs are a random page in the portal

Expert Bejegyzések: 329 Csatlakozás dátuma: 2008.10.23. Legújabb bejegyzések
I've embeded the search portlet into my theme and the search results URLs are extremely odd. I can click on results and it brings up the correct content. However, the URL is a random page on the portlet. Is there anyway to force the URL to be a specific search results page? or maybe the current page? Having the results open up a random page is odd behavior..

I have two instances and this is only happening in the second instance. No idea why that would matter but it's just how it is working..
thumbnail
Brian Scott Schupbach, módosítva 11 év-val korábban

RE: Search results URLs are a random page in the portal (Válasz)

Expert Bejegyzések: 329 Csatlakozás dátuma: 2008.10.23. Legújabb bejegyzések
I'm not sure what caused the error but I wrote a hook to fix it. Here is the code:

This is located at html/portlet/search/main_search_result_form.jsp . I'm not sure that this is the best solution but here is how I corrected it. I added this right before the first span tag. I'm using liferay 6.1


/**********************************ADDED*****************************/
/*
For some reason the URLs of the results were going to a random page. I created a page called
search-results and am forcing the results to open here.  On the page I added an asset publisher and grabbed the asset publishers unique ID.  I appended this to the new URL using the variable p_p_auth.

*/
HttpServletRequest httpReq = PortalUtil.getOriginalServletRequest(PortalUtil.getHttpServletRequest(renderRequest)); 
if(httpReq.getRequestURL().toString().contains("SecondSiteInstanceURL.org")) {
	int startOfQueryString = viewURL.lastIndexOf('?');
	viewURL = "/search-results"+viewURL.substring(startOfQueryString,viewURL.length())+"p_p_auth=TP4E7eFdFLjQ";
}
/**********************************END ADDED*************************/