I'm storing news releases in cq:page nodes with name corresponding to the release ID--which are integers that increment by 1 with each new release created. I need to be able to sort these release by the release ID to do a variety of operation, in this case to get the highest numbered release. Unfortunately I can't rely on jcr:created for this because there are special cases where the highest numbered release will not correspond to the last created page (support for a legacy system).
I've been experimenting with the query debugger to try to figure out how I would retrieve this, but when I sort on nodename, it orders results not as numbers, but strings, thus, I get results like "9000, 8200, 81320, 7000, 22000, 1700, 12000" Is there a way to cast my orderby property to an int? Or am I maybe going about this the wrong way?
type=cq:page path=/content/news orderby=nodename orderby.sort=desc