0
votes

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.

1
"And I believe that the underlying organization of the Datastore is like the organization of a full-text search engine." -- It's not.Amber
Thanks for your responses. BTW, do you have any documentation or link you can point out about this underlying organization?Martín Schonaker
The Datastore is built on top of BigTable (labs.google.com/papers/bigtable.html). It creates indices for every query your app runs (in other words, every query you run hits an index); this is why the set of queries you can run is so restricted (because only queries that can work with a single index are allowed).Amber

1 Answers

2
votes

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