a-ok Posted February 14, 2016 Share Posted February 14, 2016 Hi folks, I have a simple search setup, and I'm wanting the order of results to be sorted by parent then created date. I currently have this set up as: sort=-parent, sort=-created And here is a screenshot of my Tree structure from the CMS: However, when I get the search results; the result is putting Portfolio results before People results... any ideas where I am going wrong? I'm thinking it's to do with the fact that a 'person' has the parent 'People' but also 'People & Practice' but then couldn't work out why it was being returned in the order before 'Now'? EDIT: Thinking about it, it's because the ID of Portfolio is 1028 but the People ID is 1048; do I need to do it by sort first, then parent, then created? Thanks in advance, R Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 14, 2016 Share Posted February 14, 2016 You want to sort by '-parent.sort, -created', but I'm not sure if this is even supported currently. 1 Link to comment Share on other sites More sharing options...
a-ok Posted February 14, 2016 Author Share Posted February 14, 2016 You want to sort by '-parent.sort, -created', but I'm not sure if this is even supported currently. That totally worked. Can I confirm what the .sort does? Sort parent by the order set in the CMS? Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 14, 2016 Share Posted February 14, 2016 The property sort is nothing magic. It's just a simple integer storing the order of pages in the page tree. But as one can imagine this does only work for sibling pages, because each branches sort values are started from 0 again. You could even use 'sort=sort' to force returned pages to be in the sort order of the admin. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now