I am trying to query the google datastore for something like (with pm --> persistanceManager):
String filters = "( field == 'value' || field == 'anotherValue' )";
Query query = pm.newQuery(myType.class, filters);
When I execute - I am getting back: App Engine datastore does not support operator OR.
What's the best approach in people experience for this kind of queries?
Any help appreciated!
Perform multiple queries. The Datastore, like all other databases, isn't able to efficiently execute disjunctions. Unlike other databases, it exposes this difficulty to the user, to make it clear that what you're doing isn't efficient. Your only solution is to execute multiple queries - one for each or - and combine them.
Contrary to cletus' answer, OR-ing works, in more recent version of App Engine anyway.
Indeed, I found OR-ing not working in App Engine 1.3.0 that I had, but according to Google App Engine - Queries and Indexes (the same source cletus referred to in his answer),
I figured since his answer (and since I last updated my App Engine), App Engine must have been upgraded on this matter.
Update App Engine to 1.3.4, and the OR-ing works! Though with the limitation.
Thanks to cletus anyway:)