以下代码有效但如果我取消评论第5行我会收到错误
public void listByKindandFilterById(String kindName, String sortPropertyName, com.google.cloud.backend.core.CloudQuery.Order order,
int limit, Scope scope, CloudCallbackHandler<List<CloudEntity>> handler, String Id) {
Log.d(TAG, Id); // I am definitely getting what I expect and whats in the db
CloudQuery cq = new CloudQuery(kindName);
//cq.setFilter(Filter.eq("rideid", Id));
cq.setSort(sortPropertyName, order);
cq.setLimit(limit);
cq.setScope(scope);
this.list(cq, handler);
}
我是数据存储区的新手,只想在SQL中重新创建WHERE子句,即SELECT * kindName WHERE rideid = Id
我做错了什么?
以下是我取消评论该行时出现的错误:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 503 Service Unavailable
{
"code": 503,
"errors": [
{
"domain": "global",
"message": "com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.\nThe suggested index for this query is:\n <datastore-index kind=\"Ridemessage\" ancestor=\"false\" source=\"manual\">\n <property name=\"rideid\" direction=\"asc\"/>\n <property name=\"_createdAt\" direction=\"desc\"/>\n </datastore-index>\n\n",
"reason": "backendError"
}
],
"message": "com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.\nThe suggested index for this query is:\n <datastore-index kind=\"Ridemessage\" ancestor=\"false\" source=\"manual\">\n <property name=\"rideid\" direction=\"asc\"/>\n <property name=\"_createdAt\" direction=\"desc\"/>\n </datastore-index>\n\n"
}
答案 0 :(得分:2)
数据存储区需要一个能够提供查询的索引。您可以查看this document以更好地了解它们的工作原理。
基本上,我建议,为了解决您的问题,将代码推送到您的devserver,并确保在您的devserver上运行该查询。这将更新您的datastore-indexes.xml,并在您更新应用程序时,确保运行“更新索引”。它应该工作正常。我已经解释了类似的问题here