When saving a entity, include a random property. (eg use an Integer, and set it to a random value between 1 and 1000000)
Then when you want a random record, use the equivlent to ths GQL SELECT * FROM RandomEntity WHERE RandomProperty > 4456 ORDER BY RandomProperty ASC LIMIT 1 where the 4456 is randomly choosen. Or to account for occasional duplications of the RandomProperty could include a small offset. (say 1-10) SELECT * FROM RandomEntity WHERE RandomProperty > 4456 ORDER BY RandomProperty ASC LIMIT 5,1 I believe that should be reasonably efficient in the datastore. On 01/04/2009, sagey <[email protected]> wrote: > > hello, > > > I'd like to be able to return random results from the datastore. I'm > not sure from the documentation how i would go about doing that. I'd > appreciate some pointers. > > Thanks in advance > > > -- Barry - www.nearby.org.uk - www.geograph.org.uk - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
