Key sorting.

2 views
Skip to first unread message

Timofey Danshin

unread,
Jan 8, 2010, 6:16:00 AM1/8/10
to google-appengine
Hi. 
I am writing a cms, which has sections and articles. Both of them are represented by the same object of the type Node of my own composition. Among other fields, a node has a Set<Node>, representing it's children. Consequently, root nodes (i.e. sections have simple keys (say, Node(1))), and articles have composite keys (say, Node(1)/Node(2)). 

And for the first page of my cms i would like to have a number of articles disregard of the sections they are in. In order to do that i need to sort the articles by their keys. However,  in that sorted list they appear in the wrong chronological order because of the "first part" of their keys. I.e., apparently Node(1)/Node(7) will come earlier than Node(2)/Node(3). 

Is there a way to sort the entities in a query by the last part of their keys?

--
Best Regards,
Timofey Danshin.

Nick Johnson (Google)

unread,
Jan 18, 2010, 4:42:54 AM1/18/10
to google-a...@googlegroups.com
Hi Timofey,

If you want to do this, you'll need to add a new field with the desired sorting properties, and sort by that.

-Nick Johnson
 

--
Best Regards,
Timofey Danshin.

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.




--
Nick Johnson, Developer Programs Engineer, App Engine
Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047
Reply all
Reply to author
Forward
0 new messages