Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App engine datastore: How to implement Posts and Tags without joins?

Tags:

I'm building an application in Google App Engine (Java), where users can make posts and I'm thinking in adding tags to these posts, so I will have something like this:

in entity Post:

public List<Key> tags;

in entity Tag:

public List<Key> posts;

It would be easy to query, for example, all posts with a certain tag, but how could I get all the posts that has a list of tags? I could make a query for each tag and then make an intersection of the results, but maybe there is a better way... because that would be slow with a lot of posts.

Another thing that may be more difficult is having a post, get the posts that have tags in common ordered by the number of common tags, so I could get "similar" posts to this one, in some way.

Well, with joins this would be a lot easier, but I'm starting with app engine and can't really think about a good way to replace joins.

Thanks!