I’m using GAE in Java, I have a data table “Person” and I need doing something like:
SELECT * FROM PERSON WHERE NAME="MIKE" OR AGE=50
My code builds “AND”, I don’t know how to build the sentence with OR
Query query = new Query(getEntityKind(), getRootEntityKey());
query.addFilter("name", FilterOperator.EQUAL, "Mike");
query.addFilter("age", FilterOperator.EQUAL, 50);
Any ideas?
Thanks!
There is no
ORoperator in GAE queries. The only way is to run two queries and then merge results.Update: since 1.7.0, GAE supports
ORqueries viaCompositeFilterOperator. What it does is basically run parallel queries and then AND/OR them on server. The cost is the same as running separate queries and merging them on client, but one saves on roundtrip times.