Foren

Customize the search results page?

thumbnail
Cameron McBride, geändert vor 12 Jahren.

Customize the search results page?

Expert Beiträge: 269 Beitrittsdatum: 08.02.11 Neueste Beiträge
I would like to do two different things to the search results page:

1. Change the layout and add some other portlets to it.

2. Change the order of the sections, for example move Directory results to the top.
thumbnail
Nagendra Kumar Busam, geändert vor 12 Jahren.

RE: Customize the search results page?

Liferay Master Beiträge: 678 Beitrittsdatum: 07.07.09 Neueste Beiträge
What was the Liferay version you are using?
thumbnail
jelmer kuperus, geändert vor 12 Jahren.

RE: Customize the search results page?

Liferay Legend Beiträge: 1191 Beitrittsdatum: 10.03.10 Neueste Beiträge
1. the searchresults are displayed in the maximized search portlet. And while you could use <liferay-portlet:runtime to embed other portlets in the searchresults page that's almost certainly not what you'll want to do. Probably it would be easiest to create a search results page just like any other portal page that you lay out the way you want it, and on which you add the search portlet (portlet id 3) Then you create a jsp hook for /html/taglib/ui/search/start.jsp and change the portletURL so that it links to your search results page

2. You'll need to create a jsp hook for /html/portlet/search/search.jsp to change the ordering. You'll be looking to change the following line

portlets = ListUtil.sort(portlets, new PortletTitleComparator(application, locale));
thumbnail
Krzysiek Bąk, geändert vor 12 Jahren.

RE: Customize the search results page?

New Member Beiträge: 3 Beitrittsdatum: 17.01.12 Neueste Beiträge
Hello,

Could you explain how should I change the portletURL?
F.ex. I have search widget embedded in theme, and hidden search page which I want to display search results, how can I set up portletURL to achieve this?

Thank you in advance.
thumbnail
Niko Kyritsis, geändert vor 9 Jahren.

RE: Customize the search results page?

New Member Beiträge: 5 Beitrittsdatum: 22.02.12 Neueste Beiträge
I know I'm bringing up an old thread, but did you ever find a solution to set a display page for your search results, Krzysiek?

Thanks,
Niko
thumbnail
Jacques Traore, geändert vor 9 Jahren.

RE: Customize the search results page?

Junior Member Beiträge: 49 Beitrittsdatum: 21.01.13 Neueste Beiträge
Krzysiek Bąk:
Hello,

Could you explain how should I change the portletURL?
F.ex. I have search widget embedded in theme, and hidden search page which I want to display search results, how can I set up portletURL to achieve this?

Thank you in advance.



Hi Krzysiek Bąk,
Did you find a solution about how to set up portletURL to link it on your hidden search page?

Thanks
Siby Mathew, geändert vor 9 Jahren.

RE: Customize the search results page?

Expert Beiträge: 268 Beitrittsdatum: 04.03.11 Neueste Beiträge
Hi Jacques/Niko,
To achieve this, you can pass the plid of your hidden search page while creating the portletURL.
This is what I did :
- Created a custom jsp hook for html/taglib/ui/search/start.jsp
- Retreived the plid of my hidden search page
- Pass the plid during portletURL creation as follows :

long searchPlid = plid;
//My Hidden search page
Layout searchPage = LayoutLocalServiceUtil.fetchLayoutByFriendlyURL(group.getGroupId(), false, "/search");
if(null != searchPage) {
	searchPlid = searchPage.getPlid();
}

if (portletResponse != null) {
	LiferayPortletResponse liferayPortletResponse = (LiferayPortletResponse)portletResponse;
        // This method call was not using the plid before
        portletURL = liferayPortletResponse.createLiferayPortletURL(searchPlid, PortletKeys.SEARCH, PortletRequest.RENDER_PHASE);
}
else {
	portletURL = new PortletURLImpl(request, PortletKeys.SEARCH, searchPlid, PortletRequest.RENDER_PHASE);
}


Hope this helps.

Thanks,
Siby Mathew
Cyber Katze, geändert vor 9 Jahren.

RE: Customize the search results page?