在 Google DataStore GQL 中,如何对 WHERE 术语进行分组?

In Google DataStore GQL, how can I group the WHERE terms?

我需要在 WHERE 子句中对术语进行分组。例如,

WHERE (param1='foo1' OR param1='foo2') AND (param2='bar1' OR param2='bar2')

但是它给我一个语法错误,说括号是 "unexpected"。实际错误是:

GQL query error: Encountered "(" at line 1, column 29. Was expecting one of: "false", "null", "true", <INTEGER>, <DOUBLE>, <SINGLE_QUOTE_STRING>, <DOUBLE_QUOTE_STRING>, <UNQUOTED_NAME>, <QUOTED_NAME>, <NAME_BINDING_SITE>, <POSITION_BINDING_SITE>

那么,我有什么方法可以运行那个查询吗?

我认为您面临的问题来自 OR 运算符 - GQL 没有运算符,因此括号中的条件在句法上不正确。

来自 Clauses table 中的 WHERE 行(强调我的):

Limits the result set to those entities that meet one or more conditions. Each condition compares a property of the entity with a value using a comparison operator. If multiple conditions are combined with the AND keyword, then an entity must meet all of the conditions to be returned by the query. GQL does not have an OR operator.