Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Engine datastore does not support operator OR

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!

like image 733
JohnIdol Avatar asked Dec 01 '22 07:12

JohnIdol


1 Answers

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.

like image 93
Nick Johnson Avatar answered Dec 03 '22 20:12

Nick Johnson