即使在datastore-index.xml中指示,也未创建索引

时间:2014-02-24 15:15:16

标签: java google-app-engine indexing google-cloud-datastore

我的应用ID是gusclabs。

datastore-index.xml中的索引条目:

<datastore-index kind="ItemGroupOptionalQuantities" ancestor="true" source="manual">
    <property name="quantityFrom" direction="asc"/>
</datastore-index>

appspot-log出错:

Type 'com.google.appengine.api.datastore.DatastoreNeedIndexException' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.
The suggested index for this query is:

    <datastore-index kind="ItemGroupOptionalQuantities" ancestor="true" source="manual">
        <property name="quantityFrom" direction="asc"/>
    </datastore-index>

我在新版本中部署应用后更新了实体。

当我使用quantityFrom进行查询时,我有这个错误。

--- start query ----

Query query = new Query("ItemGroupOptionalQuantities");
query.setAncestor(ancestorKey);
query.addSort("quantityFrom", Query.SortDirection.ASCENDING)

PreparedQuery preparedQuery = datastore.prepare(query);

FetchOptions fetchOptions = FetchOptions.Builder.withLimit(10);

QueryResultList<Entity> entities = preparedQuery.asQueryResultList(fetchOptions);

--- end query ---

2 个答案:

答案 0 :(得分:0)

如果您只是更新应用程序,那么您将需要等待几分钟才能构建这些索引。如果您访问数据存储索引页面,则可以从应用的信息中心看到您拥有的索引类型以及它们的状态。

答案 1 :(得分:0)

解决。

datastore-indexes.xml文件的正确位置是“/ war / WEB-INF”,而不是“/ war / WEB-INF / appengine-generated”

感谢Patrick和Lipis。