This one year old thread discusses the same problem I think:
http://groups.google.com/group/google-appengine/browse_thread/thread/b35a0387dfdf918b/55563f57306defbc?lnk=gst&q=mark+as+read#55563f57306defbc

A possible solution:

class Message(db.Model):
  sender=db.StringProperty()
  body=db.TextProperty()

class MessageIndex(db.Model):
  # parent = Message, one message can have several
  # MessageIndex children to spread the load of recipients
  recipient = db.StringListProperty()

class MessageRead(db.Model):
  # key_name = message_id + recipient_id
  # The entity is written when a message is read
  pass

def getMessagesForUser( user, nb_msgs ):
  indexes = MessageIndexes.all(keys_only=True).filter(
              recipient= user).fetch( nb_msgs )
  for k in indexes:
    keys.append( k.parent() )
    keys.append( db.Key.from_path('MessageRead',
              k.parent().id() + recipient_id) )
  messages = db.get(keys)


I guess it's about the same that what Stephen is proposing.




On Jan 11, 1:21 pm, nischalshetty <nischalshett...@gmail.com> wrote:
> You guys are all awesome. My friend and I are soon going to finalize a
> way and I'll post it here. Your feedback would be greatly appreciated.
>
> -N
>
> On Jan 10, 10:20 pm, master outside <masterouts...@gmail.com> wrote:
>
> > One option is to use a date time stamp when they mark all as read. If
> > you allow people to mark items as unread then you in addition need
> > have a way to detect that on old items. For example if you were  to
> > use '0' for unread and '1' for read you could use '2' to override the
> > the all read after time.
>
> > On Jan 9, 11:57 am, nischalshetty <nischalshett...@gmail.com> wrote:
>
> > > Say a user selects 5000 unread messages (each message is an entity)
> > > and wants to mark all of them as read. It would be a massive update.
> > > Can anyone help me on what the best way to do such a large update is?
>
> > > Is there a different way to do this apart from updating each of the
> > > 5000 entities by marking their status as read? Even if there is no
> > > escaping the large update, how do you update so many entities on
> > > appengine?
>
>

-- 
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-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to