How do you use list properties in Google App Engine datastore in Java?

蓝咒 提交于 2019-11-29 04:34:20

See my blog post exactly on this: Efficient Keyword Search with Relation Index Entities and Objectify for Google Datastore. It talks about implementing search with list properties using Relation Index Entities and Objectify.

To summarize:

  Query<DocumentKeywords> query = ofy.query(DocumentKeywords.class);
  for (String keyword : keywords) {
    query = query.filter("keywords", keyword);
  }

  Set<Key<Document>> keys = query.<Document>fetchParentKeys();

  Collection<Document> documents = ofy.get(keys).values();

where DocumentKeywords contains a list property (collection) of all keywords for its Document entity, and Document entity is a parent for DocumentKeywords.

In JDO use

@Persistent
private List<ContactInfo> contactInfoSets;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!