The following two GQL queries work:
SELECT * FROM Customer WHERE FirstName = "John"
SELECT * FROM Customer WHERE Rating > 4.0
But, when I combine them...
SELECT * FROM Customer WHERE FirstName = "John" AND Rating > 4.0
... I get an empty result set even though running the queries individually finds the entity that I am looking for. How do I compare more than one property?
Here's what I've done:
- I made sure that at least one entity exists where both is true.
- I created an index for the properties:
Patrick Costello at Google answered my question:
Basically, the problem was that I created an index on all the properties. However, each "type" of query (in this case, a query comparing FirstName and Rating) needs its own index (i.e. an index with just FirstName and Rating). I hope this helps someone!