Fórum
Ordering search result
akash kumar, modificado 10 Anos atrás.
Ordering search result
New Member Postagens: 8 Data de Entrada: 11/07/12 Postagens Recentes
Hi Experts,
I am using Liferay 6.1 GA2 with Solr4
While i am searching search results coming from different portlets like Blogs, wiki, web content ,custom portlets.
Now i have requirement that search results should show my custom portlets data on top always.
Like suppose i have a custom portlet NewFashion-cloth.
Now if i search something in Liferay search portlet , search results is coming properly but results from my portlets showing in third place.
That is after blog due to Liferay sorting order that we set in configuration of search portlets.
I want resutls should always show NewFashion-cloth portlets results on top.
Any help would be appreciated.
Thanks & Regards
I am using Liferay 6.1 GA2 with Solr4
While i am searching search results coming from different portlets like Blogs, wiki, web content ,custom portlets.
Now i have requirement that search results should show my custom portlets data on top always.
Like suppose i have a custom portlet NewFashion-cloth.
Now if i search something in Liferay search portlet , search results is coming properly but results from my portlets showing in third place.
That is after blog due to Liferay sorting order that we set in configuration of search portlets.
I want resutls should always show NewFashion-cloth portlets results on top.
Any help would be appreciated.
Thanks & Regards
Prahsant Chandra, modificado 10 Anos atrás.
RE: Ordering search result
New Member Postagens: 11 Data de Entrada: 04/06/13 Postagens Recentes
Hi Akash,
It seems, you need to sort the hit results based on createdDate, so that most latest records would be on. You can achieve this by setting sorting mechanism into searchContext object. It will replace the default sorting type. The following code snippet may help you:
Sort[] sorts = SortFactoryUtil.getDefaultSorts();
sorts[0] = new Sort("createDate", true);
searchContext.setSorts(sorts);
Thanks,
Prashant
It seems, you need to sort the hit results based on createdDate, so that most latest records would be on. You can achieve this by setting sorting mechanism into searchContext object. It will replace the default sorting type. The following code snippet may help you:
Sort[] sorts = SortFactoryUtil.getDefaultSorts();
sorts[0] = new Sort("createDate", true);
searchContext.setSorts(sorts);
Thanks,
Prashant
akash kumar, modificado 10 Anos atrás.
RE: Ordering search result
New Member Postagens: 8 Data de Entrada: 11/07/12 Postagens Recentes
Hi Prashant,
Thanks for your reply.
I want to show the results based on Portlets.
I want to show the results from NewFashion-cloth portlet on top.
Thanks,
Thanks for your reply.
I want to show the results based on Portlets.
I want to show the results from NewFashion-cloth portlet on top.
Thanks,
Oliver Bayer, modificado 10 Anos atrás.
RE: Ordering search result
Liferay Master Postagens: 894 Data de Entrada: 18/02/09 Postagens Recentes
Hi Akash,
I'm not sure if it's configurable but you can change it with overriding the default behaviour.
In Liferay v5.2.3 you'll have to override the search\search.jsp:
I haven't done it in Liferay v6.2.0 but looking at the new code you can maybe add your customization to search\main_search:jspf:
HTH Oli
I'm not sure if it's configurable but you can change it with overriding the default behaviour.
In Liferay v5.2.3 you'll have to override the search\search.jsp:
List portlets = PortletLocalServiceUtil.getPortlets(company.getCompanyId(), false, false);
...
insert some "magick" ordering of the portlets list so your portlet is in first place
I haven't done it in Liferay v6.2.0 but looking at the new code you can maybe add your customization to search\main_search:jspf:
List<facet> facetsList = ListUtil.fromCollection(facets.values());
...
this is a list of different search "types" so maybe you can put your custom object in first place</facet>
HTH Oli
Dhanwan S Ramasane, modificado 9 Anos atrás.
RE: Ordering search result
Junior Member Postagens: 27 Data de Entrada: 09/04/12 Postagens RecentesPrashant Chandra:
Hi Akash,
It seems, you need to sort the hit results based on createdDate, so that most latest records would be on. You can achieve this by setting sorting mechanism into searchContext object. It will replace the default sorting type. The following code snippet may help you:
Sort[] sorts = SortFactoryUtil.getDefaultSorts();
sorts[0] = new Sort("createDate", true);
searchContext.setSorts(sorts);
Thanks,
Prashant
Thanks Prashant it is also useful for me ... your help is appreciated