Java – application engine data storage: how to implement posts and tags without connection?

I am building an application in Google App Engine (Java) where users can post. I am considering adding tags to these posts, so I will have this:

Entity Publishing:

public List<Key> tags;

Entity label:

public List<Key> posts;

It is easy to query, for example, all posts with a tag, but how to get all posts with a tag list? I can query each tag and then do a cross result, but maybe there is a better way because it will be slow for many posts

Another thing that may be more difficult is to receive a post and get a post with common tags, so I can get a "similar" post in some way

Well, joining it would be easy, but I started with the application engine and couldn't really consider a good way to replace the connection

thank you!

Solution

With this design, I'm afraid your tag entity may be a bottleneck, especially if you expect some tags to be very common

This means that every time you need to get your Java tag entity, you will extract 14K key data from the data store Then when you make a put, you will send it back This may add many bytes. > Except for byte round trips, each put will need to update the index Each entry in the listproperty maps to a separate index entry So now you are doing a lot of index updates This led us to No. 3... > explosion index How many restrictions does each entity have on the index entries it can have I think the limit per entity is 5000 So this is actually a hard limit on how many posts can have the same label

Further reading:

>This post involves some problems with large lists

The good news is that some of your requests will be easily handled by the post entity For example, you can easily find all posts that contain a list of tags using the following query filters:

Query q = pm.newQuery(Post.class)
q.setFilter("tags" == 'Java' && "tags == 'appengine'");

For all posts with Java or App Engine tags, you need to execute a query for each tag and then combine the results yourself The data store does not handle or / in type operations now

Finding related posts sounds tricky After some coffee, I'll think about it

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>