简体   繁体   English

DatastoreNeedIndexException:找不到匹配的索引。 使用Objectify

[英]DatastoreNeedIndexException: no matching index found. Using Objectify

Having this error after deploying my code to cloud, using google appengine, i use objectify indexing for my filtering. 使用Google Appengine将代码部署到云后,出现此错误,我使用对象化索引进行过滤。

here is my java class (Entity) file containing the index 这是我的包含索引的java类(实体)文件

@Entity
public class Session{
   @Index private Integer year;
   @Index private Key<Institute> institute;
  //some other manipulation goes below
   }

When am trying to call a list of entity from datastore using objectify like this 当试图像这样使用objectify从数据存储中调用实体列表时

ofy().load().type(Session.class).filter("institute",t).order("year").list();//order by year

it throws the below error on my console , the below image shows it , sorry not too clear 它在我的控制台上抛出以下错误,下图显示了它,对不起不太清楚

在此处输入图片说明

You need to add suggested index definition to your datastore-indexes.xml file. 您需要将建议的索引定义添加到datastore-indexes.xml文件中。 If you don't have this file, you need to create it in /war/WEB-INF/ folder: 如果没有此文件,则需要在/ war / WEB-INF /文件夹中创建它:

<?xml version="1.0" encoding="utf-8"?>
<datastore-indexes
  autoGenerate="true">

    <datastore-index kind="Session" ancestor="false" source="manual">
        <property name="institute" direction="asc"/>
        <property name="year" direction="asc"/>
    </datastore-index>
</datastore-indexes>

Note that most index definitions can be auto-genereated when you test your app on the development server, but sometimes it's not easy to test every possible use case and manual definitions may be an easier option. 请注意,当您在开发服务器上测试应用程序时,大多数索引定义都可以自动生成,但是有时测试每个可能的用例并不容易,手动定义可能更容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 com.google.appengine.api.datastore.DatastoreNeedIndexException:找不到匹配的索引 - com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found Order上的Objectify DatastoreNeedIndexException错误 - Objectify DatastoreNeedIndexException error on Order 使用 Firestore 原生对象化 - 未找到匹配的索引 - Objectify with Firestore native - no matching index found 排序项目客观化获取错误没有找到匹配的索引 - Sort Items Objectify Getting error No matching Index Found Objectify:对查询的结果进行排序(“找不到匹配的索引”错误) - Objectify: sort results of a query (“no matching index found” error) Google App Engine 错误:找不到匹配的索引。 (爪哇) - Google App Engine Error: No matching index found. (Java) 找不到匹配的Bean类型。 在使用发布者和使用者时 - No matching bean of type found. While using publisher and consumer 找不到匹配的索引-GAE - no matching index found - GAE 找不到与api.imgur.com匹配的主题备用DNS名称。 使用抄写员访问api.imgur.com时 - No subject alternative DNS name matching api.imgur.com found. when using Scribe to access api.imgur.com 找不到方言类。 \\使用休眠时 - Dialect class not found. \when using hibernate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM