Personally, I would try attacking this problem from a different
direction. I'm assuming that if Sally is John's friend then John is
also Sally's friend. So, let's suppose that Sally (key S1) reads the
book Great Expectations (key E1) and has friends John (key J1) and
Mike (key M1). I would add a table that looks something like:

userKey
tag
bookKey
numFriends
friendsList

and add an index on userKey, tag, bookKey, numFriends

So, when Sally indicates she has read Great Expectations (E1). I would
add (or modify if entries for these users/book combinations already
exist) two entries to this table (one entry for each of her friends),
so it would look like:

userKey  tag                bookKey   numFriends   friendsList
---------------------------------------------------------------
  J1    historical+drama      E1           1           Sally
  M1    historical+drama      M1           1           Sally

Now let's say Ken (K1) is a friend of John's but not Mike's and he
reads Great Expections, so table would look like:

userKey  tag                bookKey   numFriends   friendsList
---------------------------------------------------------------
  J1    historical+drama      E1           2          S1,K1
  M1    historical+drama      M1           1          S1

And finally, let's say Betty (B1) is a friend of Johns and reads Moby
Dick (D1) so table would be:

userKey  tag                bookKey   numFriends   friendsList
---------------------------------------------------------------
  J1    historical+drama      E1           2          S1,K1
  J1    historical+drama      D1           1          B1
  M1    historical+drama      M1           1          S1

Now, querying this table should be fast and efficient along with
sorted properly.

Well, this is the way I'd do it. Hope it helps.
Steve

-- 
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.

Reply via email to