Let's say I have a simple Entity hierarchy setup where a base (abstract) class has common fields:
@Entity
public abstract class Base {
@Id
Long mId;
@Index
Long mVal;
}
Now I have a subclass (both in Java and in Objectify):
@Subclass(index=true)
public class Concrete extends Base {
@Index mOtherVal;
}
When Concrete is saved, it is properly creating the entries in the datastore for all of the fields (mId, mVal and mOtherVal). However, if I attempt to run a query against Concrete entries with a filter on mVal, app engine is complaining that there is no index:
List<Concrete> result =
OfyService.ofy().load().type(Concrete.class).filter("mVal > ", 10).list();
I see an exception log like this:
com.google.api.server.spi.SystemService invokeServiceMethod: cause={0}
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.
The suggested index for this query is:
<datastore-index kind="Post" ancestor="false" source="manual">
<property name="^i" direction="asc"/>
<property name="mVal" direction="asc"/>
</datastore-index>
I have not created a datastore-indexes.xml intentionally, as the Objectify docs state that indexes on fields are created on the fly. So my question: is this a known limitation of Objectify, or have I done something incorrectly?
^iproperty), the query needs a composite index for the class information (^i) andmVal. My guess is that the Objectify docs are referring to single property indexes, but I'll defer to stickfigure on that! - tx802datastore-indexes.xmland see if it changes the behavior. - Larry Schiefer