Jump to content

Sort by parent then by created (multiple parents)


a-ok
 Share

Recommended Posts

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: post-2553-0-35439900-1455470977_thumb.pn

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...