App Engine 数据存储区不支持运算符 OR [英] App Engine datastore does not support operator OR
问题描述
我正在尝试查询 google 数据存储库中的内容(使用 pm --> persistanceManager):
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);
当我执行时 - 我回来了:App Engine 数据存储不支持运算符 OR.
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?
感谢任何帮助!
推荐答案
执行多个查询.与所有其他数据库一样,Datastore 无法有效地执行分离.与其他数据库不同,它向用户公开了这种困难,以表明您所做的工作效率低下.您唯一的解决方案是执行多个查询 - 每个查询一个或 - 并将它们组合起来.
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.
这篇关于App Engine 数据存储区不支持运算符 OR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!