在你动手开发GAE应用之前,最好先考虑下你的应用是否真的可以跑在GAE上,如果不仔细看它的开发手册,你很可能会漏掉一个严重的问题:
Inequality Filters Are Allowed On One Property Only
A query may only use inequality filters (<
, <=
, >=
, >
) on one property across all of its filters.
For example, this query is allowed:
select from Person where birthYear >= minBirthYearParam
&& birthYear <= maxBirthYearParam
However, this query is not allowed, because it uses inequality filters on two different properties in the same query:
select from Person where birthYear >= minBirthYearParam
&& height >= minHeightParam // ERROR
Filters can combine equal (==
) comparisons for different properties in the same query, including queries with one or more inequality conditions on a property. This is allowed:
select from Person where lastName == lastNameParam
&& city == cityParam
&& birthYear >= minBirthYearParam
The query mechanism relies on all results for a query to be adjacent to one another in the index table, to avoid having to scan the entire table for results. A single index table cannot represent multiple inequality filters on multiple properties while maintaining that all results are consecutive in the table.
这个限制很直接,就是非等于的过滤条件只能应用到一个字段(属性)上,原来在关系型数据库上很简单的一些查询,到了GAE上就变得不可行了。
在开始开发GAE应用前,先考虑清楚你的应用是否会不可避免的碰到这个问题,或者是否可以放弃很多功能,看来便宜不是那么好占的。
0 Comments
1 Pingback