我正在写一个查询,但它总是说“找不到匹配的索引”。我不知道为什么。我的代码如下:
Query query = pm.newQuery(Classified.class);
query.setFilter("emp_Id == emp");
query.setOrdering("upload_date desc");
query.declareParameters("String emp");
List<Classified> results = (List<Classified>)query.execute(session.getAttribute("emp_Id").toString());
<?xml version="1.0" encoding="utf-8"?>
<datastore-indexes autoGenerate="true">
<datastore-index kind="Classified" ancestor="false">
<property name="emp_Id" direction="asc" />
<property name="category" direction="asc" />
<property name="upload_date" direction="desc" />
</datastore-index>
</datastore-indexes>
我已经添加了上面的索引,但是没有帮助。
最佳答案
我相信你需要配置一个 Datastore Index .在 Eclipse 中可能已经在 WEB-INF/appengine-generated/datastore-indexes-auto.xml
中为您生成了一个,您只需将其复制到 WEB-INF/datastore-indexes。 xml
并再次部署。
关于java - 谷歌 App 引擎错误 : No matching index found. (Java),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5403080/