[英]com.google.appengine.api.datastore.DatastoreNeedIndexException error in Sample App
Im testing a GAE Modules App . 我正在测试GAE模块应用程序 。 My application it is very simple and it has not any query to Cloud SQL or anywhere, it is just a helloworld.
我的应用程序非常简单,它对Cloud SQL或任何地方都没有任何查询,它只是一个helloworld。
However, I'm getting the f 但是,我得到了
com.google.appengine.api.datastore.DatastoreNeedIndexException: no mat
<datastore-index kind="Greeting" ancestor="true" source="manual">
<property name="date" direction="desc"/>
</datastore-index>
How could it be possible? 怎么可能呢?
I had developed many times other GAE applications and I have never met with this issue 我开发了许多其他GAE应用程序,但从未遇到过这个问题
Queries need to be indexed or else it won't work. 查询需要建立索引,否则将无法正常工作。 In this case it seems like when you are returning the greetings, you sorted them by date.
在这种情况下,当您返回问候语时,您似乎按日期对它们进行了排序。 Datastore stores data in pre-sorted tables based on the indexed fields of the entity;
数据存储区根据实体的索引字段将数据存储在预先排序的表中; which means if you never indexed "date", there doesn't exist a table where all the greetings are sorted by date.
这意味着,如果您从未索引过“日期”,那么就不会有一个表,其中所有问候语均按日期排序。
All you need is to add that datastore index block to your datastore-indexes.xml in your WEB-INF folder to fix it. 您需要做的就是将该数据存储区索引块添加到WEB-INF文件夹中的datastore-indexes.xml中进行修复。
After adding the index, redeploy and wait about 10 minutes for all your old data to be indexed (it can take longer if you have more data). 添加索引后,重新部署并等待大约10分钟,以便对所有旧数据建立索引(如果您有更多数据,则可能需要更长的时间)。 Try again and it should work now.
再试一次,现在应该可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.