2
votes

Having this error after deploying my code to cloud, using google appengine, i use objectify indexing for my filtering.

here is my java class (Entity) file containing the index

@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

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

enter image description here

1
I would love to see how this is solved facing the same issue .I.Tyger

1 Answers

6
votes

You need to add suggested index definition to your datastore-indexes.xml file. If you don't have this file, you need to create it in /war/WEB-INF/ folder:

<?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.