In Android Studio, I'm trying to use Google Clood Datastore from an Android app.
With the Google example https://cloud.google.com/datastore/docs/concepts/indexes#Datastore_Indexes_and_properties I am able to add Tom (32 years old) and Lucy (30 years old) as Person and as children of the Company Acme. I can see these two entries are in the datastore in the Google Developers Console.
I can retrieve children from Company Acme if I set a query filter as below.
Key acmeKey = makeKey("Company", "Acme").build(); makeFilter("__key__", PropertyFilter.Operator.HAS_ANCESTOR, makeValue(acmeKey)).build()));- If I want to retrieve only Person where age is equal to 32 I add to the filter above
makeFilter("age", PropertyFilter.Operator.EQUAL, makeValue(32)).build()Then, I get the Person Tom.
- If I want to retrieve only Person where age is equal to 32 I add to the filter above
- But, if, instead of
Operator.EQUALI put an inequality filter likeOperator.LESS_THANorOperator.GREATER_THANI get the error "no matching index found".
I think it's a problem of indexes, but I really don't understand how can I set an index. I use Android Studio and I don't use at all the App Engine. I just want to retrieve data as I do with MySQL with a simple WHERE age > 32.
Btw, I tried with GQL and I get exactly the exact same problem, work with EQUAL, but not with GREATER_THAN (and same in https://developers.google.com/apis-explorer).
So, does anybody know how I can fix this problem ? Thanks !!