Hi guys,
I'm using Objectify and have a model like this:
@Entity(name = "D")
@Indexed
public class Detail extends AbstractString implements Serializable {
private static final long serialVersionUID = 1L;
@Parent
private Key<User> user;
private Date dob;
private double ordering;
private int contactable; // Just added
// Tons of other fields
// Getters and setters
}
With the following index:
<datastore-index kind="D" ancestor="false" source="manual">
<property name="contactable" direction="desc"/> <!-- Just added -->
<property name="gender" direction="asc"/>
<property name="province" direction="asc"/>
<property name="ordering" direction="desc"/>
<property name="dob" direction="desc"/>
</datastore-index>
And here's my code snippet:
val query = new Query("D")
query addSort("contactable", DESCENDING) // Just added
query addSort("ordering", DESCENDING)
query addSort("dob", DESCENDING)
Now, if I *dont* use "contactable" field (i.e. remove all "just added"
stuff), everything works. But as soon as I add that field, an exception is
thrown:
WARNING: /_/search.json
java.lang.IndexOutOfBoundsException: fromIndex = -1
at java.util.SubList.<init>(AbstractList.java:600)
at java.util.RandomAccessSubList.<init>(AbstractList.java:758)
at java.util.AbstractList.subList(AbstractList.java:468)
at
java.util.Collections$UnmodifiableRandomAccessList.subList(Collections.java:1226)
at
com.google.appengine.api.datastore.CompositeIndexManager.minimumCompositeIndexForQuery(CompositeIndexManager.java:197)
at
com.google.appengine.api.datastore.dev.LocalCompositeIndexManager.minimumCompositeIndexForQuery(LocalCompositeIndexManager.java:598)
at
com.google.appengine.api.datastore.dev.LocalCompositeIndexManager$IndexCache.verifyIndexExistsForQuery(LocalCompositeIndexManager.java:355)
at
com.google.appengine.api.datastore.dev.LocalCompositeIndexManager$IndexCache.access$300(LocalCompositeIndexManager.java:334)
at
com.google.appengine.api.datastore.dev.LocalCompositeIndexManager.manageIndexFile(LocalCompositeIndexManager.java:251)
at
com.google.appengine.api.datastore.dev.LocalCompositeIndexManager.processQuery(LocalCompositeIndexManager.java:199)
at
com.google.appengine.api.datastore.dev.LocalDatastoreService$9.run(LocalDatastoreService.java:1082)
at java.security.AccessController.doPrivileged(Native Method)
at
com.google.appengine.api.datastore.dev.LocalDatastoreService.runQuery(LocalDatastoreService.java:1079)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.callInternal(ApiProxyLocalImpl.java:527)
at
com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:481)
at
com.google.appengine.tools.development.ApiProxyLocalImpl$AsyncApiCall.call(ApiProxyLocalImpl.java:458)
at
java.util.concurrent.Executors$PrivilegedCallable$1.run(Executors.java:461)
at java.security.AccessController.doPrivileged(Native Method)
at
java.util.concurrent.Executors$PrivilegedCallable.call(Executors.java:458)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
TL;DR: I want to add an indexable int field for inequality filter into an
existing previously-working code, but I get
"java.lang.IndexOutOfBoundsException: fromIndex = -1".
Is this a limitation of GAE where sorted fields < 3? Or what am I missing?
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/hIby2OBWL54J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.