Google App Engine 数据存储区中的父键集群
我有一个包含包含父键的实体的模型。我想知道在给定子实体一些属性限制的情况下是否可以进行特定查询以仅获取父实体的键。
我将尝试举一个例子。假设我们有人名、他们的父母(只是键)和他们最喜欢的颜色:
| Name | Parent | Color | ----------------------------- | Robert | Albert | Yellow | | Rupert | Albert | Yellow | | Gilbert | Albert | Green | | Q-bert | Rupert | Yellow |
当查询颜色 Yellow
时,我希望查询能够获取以下列表,结果不包含重复的元素: <代码><阿尔伯特,鲁珀特>。
请注意,我对孩子不感兴趣,只对父母的钥匙感兴趣。另请注意,尽管我可以将重复的键分组到 Set
中,但这会破坏应用程序的分页。
我知道没有不同
查询,但搜索引擎通常具有“集群”功能来完成此任务。我认为数据存储的底层组织就像全文搜索引擎的组织。这就是我问的原因。
顺便说一句,我正在使用低级 Java 数据存储 API。
提前致谢。
I have a model with entities which includes parent keys. I want to know if it's possible to make a specific query to obtain only the keys of the parents given some attribute restrictions on the children entities.
I'll try to give an example. Suppose that we have names of persons, their parent (just the key), and their favorite color:
| Name | Parent | Color | ----------------------------- | Robert | Albert | Yellow | | Rupert | Albert | Yellow | | Gilbert | Albert | Green | | Q-bert | Rupert | Yellow |
I want a query to obtain the following list without repeated elements as a result, when querying for the color Yellow
: < Albert, Rupert >
.
Notice that I'm not interested in the children, just the keys of the parents. Note also that although I could group the repeated keys in a Set<Key>
that would break the paging of my application.
I know there are no distinct
queries, but search engines usually have a "clustering" feature to accomplish this task. And I believe that the underlying organization of the Datastore is like the organization of a full-text search engine. That's why am asking.
BTW, I'm using the low-level Java Datastore API.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GAE 数据存储没有此功能。 (一般来说,数据存储区不会对其返回的数据进行任何操作 - 唯一涉及的逻辑是选择要返回的项目。)
The GAE Datastore does not have this functionality. (In general, the datastore does not do any manipulation of the data it returns - the only logic involved is in selecting what items to return.)