Message Boards
sort SearchResultsPortlet results
sort SearchResultsPortlet results
Junior Member Posts: 96 Join Date: 2/4/14 Recent PostsHi,
I need to show the results of a search by createdDate.
I'm not sure how the SearchResultsPortlet is sortering the results, but it is not by createdDate. I've tried to change this sort by configuration of searchResultsPortlet or SearchOptionsPortlet by none of these portlets causes the results to be displayed by createdDate.
I've created a new Facet to do this requiriment but what I need is to directly show the results sortered and not after clicking in the facet.
How can I achieve this requirement?
Any idea?
Kind regards,
Iñigo
RE: sort SearchResultsPortlet results
Expert Posts: 291 Join Date: 2/13/13 Recent PostsI didn't see what Liferay version you're using, but on 7.2 and 7.3 you can do this with the Custom Filter widget.
See Filtering Search Results for more details, and let us know if you run into any issues.
RE: RE: sort SearchResultsPortlet results
Junior Member Posts: 96 Join Date: 2/4/14 Recent PostsSorry I forgot to write the version...-
I'm using a Liferay 7.2 version with dxp-8-7210 patching level.
RE: sort SearchResultsPortlet results
Expert Posts: 291 Join Date: 2/13/13 Recent PostsGreat, then you can use the Cusomt Filter widget. It's a bit hard to see but there's a hyperlink to the docs in my last post. Here it is again, less disguised:
RE: RE: sort SearchResultsPortlet results
Junior Member Posts: 96 Join Date: 2/4/14 Recent PostsThanks for your quick response.
I'm trying to make the filter by createDate, but I can't achieve yet, any suggestion?
When I use the sort Portlet, the URL result is something like ...&sort=createDate%2B, I need to create something like that using the custom Filter i guess
RE: sort SearchResultsPortlet results
Expert Posts: 291 Join Date: 2/13/13 Recent PostsAhh shoot, you are trying to sort not filter. I shou;dn't have replied before having any coffee :(
So sorry to send you down the wrong path, let me look into it a bit more.
RE: sort SearchResultsPortlet results
Expert Posts: 291 Join Date: 2/13/13 Recent PostsWhen I use the sort Portlet, the URL result is something like ...&sort=createDate%2B, I need to create something like that using the custom Filter i guess
Is there a reason you're not using the Sort Portlet?
RE: RE: sort SearchResultsPortlet results
Junior Member Posts: 96 Join Date: 2/4/14 Recent PostsThe Sort Portlet works properly when I select the create option in the select but, what i need, its to show the results sorted by created Date when the page is loaded, in the first view without clicking anything.
The results have to be showed by createDate- by default
RE: sort SearchResultsPortlet results
Expert Posts: 291 Join Date: 2/13/13 Recent PostsYeah, I see what you mean. I expected that if we put the created option at the top of the sort configuration, it would be applied on page load. But it's not. I'm going to check two things:
- Is it expected that the first option in the sort widget should be applied by default?
- Is there another way to enforce the default sort order in the results widget?
RE: sort SearchResultsPortlet results
Expert Posts: 291 Join Date: 2/13/13 Recent PostsI've asked these questions internally, and so far, we think you've hit a bug in the sort portlet. The first option configured in the Sort Portlet (Relevance OOTB) should probably be applied on page load, so switching the order to use created as the first option should be all you need to do. However, as you and I have both observed, it's not working as expected.
I've filed a ticket here: https://issues.liferay.com/browse/LPS-123103
RE: RE: sort SearchResultsPortlet results
Junior Member Posts: 96 Join Date: 2/4/14 Recent PostsThanks to create the ticket.
I'll be waiting for the answer of the ticket before of develop other diferent solutions.
Kind regards