簡體   English   中英

com.google.appengine.api.datastore.DatastoreNeedIndexException:找不到匹配的索引

[英]com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found

使用Objectify部署Google App Engine服務器的APP時遇到以下異常,盡管我已經配置了應用程序的所有索引。 仍然不明白為什么我會收到此異常,由於此錯誤,我無法在此Web應用程序上執行任何操作。

生產服務器中的異常

/search
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.
The suggested index for this query is:
<datastore-index kind="M_TAXI" ancestor="false" source="manual">
    <property name="cityName" direction="asc"/>
    <property name="updatedOn" direction="asc"/>
</datastore-index>

datastore.indexes.xml

<?xml version="1.0" encoding="UTF-8"?>
<datastore-indexes autoGenerate="true">
<datastore-index kind="M_COUNTRY" ancestor="false" source="auto">
 <property name="countryCode" direction="asc" />
 <property name="countryName" direction="asc" />
 <property name="active" direction="asc" />
</datastore-index>
<datastore-index kind="M_CITY" ancestor="false" source="auto">
 <property name="countryCode" direction="asc" />
 <property name="cityName" direction="asc" />
 <property name="cityCode" direction="asc" />
 <property name="active" direction="asc" />
</datastore-index>
<datastore-index kind="M_TAXI" ancestor="false" source="auto">
 <property name="cityName" direction="asc" />
 <property name="supplierUserName" direction="asc" />
 <property name="updatedOn" direction="asc" />
 <property name="active" direction="asc" />
 <property name="countryName" direction="asc" />
</datastore-index>
</datastore-indexes>

來自生產服務器的數據存儲索引圖像快照

數據存儲索引圖像快照

拋出異常的查詢無法使用現有的M_TAXI。 請嘗試插入

<datastore-index kind="M_TAXI" ancestor="false" source="manual">
    <property name="cityName" direction="asc"/>
    <property name="updatedOn" direction="asc"/>
</datastore-index>

在</ datastore-indexes>結束標記之前和之后的另一個M_TAXI元素之前的datastore.indexes.xml中,並報告結果是什么。

您必須在datastore.indexes.xml添加這些索引

<datastore-index kind="M_TAXI" ancestor="false" source="manual">
    <property name="cityName" direction="asc"/>
    <property name="updatedOn" direction="asc"/>
</datastore-index>

由於Appengine數據存儲區是無架構的,因此您必須為不同的查詢添加單獨的索引。

請參閱此stackoverflow帖子

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM