Great question! I have a somewhat similar model in my app (it's not articles but the query is similar), here's how I do it:
I de-normalise the data specifically for this query, that is I have a kind: UserComment: user = db.UserProperty() last_commented = db.DateTimeProperty() # de-normalised data from the article model (key, title, slug, etc). When the user creates a comment, I add a UserComment if it's the first comment for the user in this article. I also add an entity to the job queue model for background processing. The background worker (triggered by pinging from an external box) updates UserComment.last_commented for all users that also commented the article. It's far from perfect, there's a (slight) delay in update, but otherwise it works. I'm very interested in how others would implement this. Alex -- www.muspy.com On Nov 13, 9:50 am, MajorProgamming <[EMAIL PROTECTED]> wrote: > I was wondering how to approach the following: > > Suppose I have three DB Models that look something like this: > > MainListOfArticles(db.Model): > articleText=db.Text > [...] > > CommentsOnArticles(db.Model): > commentText=db.Text > articleRef=db.ReferenceProperty(MainListOfArticles) > userThatWrote=db.UserProperty > [...] > > Users(db.Model): > userObject=db.UserProperty > [...] > > Now suppose I would like to retreive all articles that the user > commented on, based on the recency of the latest comment on that > article. I.e: when a user logs in he gets a decending list of all > articles *that he commented on* sorted by how recently they were > commented on (by others). > > To put it in other words: To get all articles based on the recency of > their comments would be easy: simply retrieve the comments sorted by > order descending. However, I would like a way to specifically retreive > those that the user commented on. > > Another point: I want the solution to scale. Keep in mind that there > could be an infinite number of articles and users. So storing them in > an individual entity would not work. There is a 1MB limit per entity > (that probably squashes many possible solutions). > > Thanks for your help, > > And if I didn't explain everything correctly, please ask me to clarify > a point.... --~--~---------~--~----~------------~-------~--~----~ 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-appengine@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---