Reputation: 291
There is some restriction to add keys to the datastore-indexes?
I have Test.java
@EntityBean(entityGroup="TestRoot", entityGroupKeyName="TestList")
public class Test implements Serializable, JSONConvertible {
@Property(key=true,indexable=true)
private String keyName;
@Property(indexable=true)
private String userCode;
@Property(indexable=true)
private String name;
...
And in my datastore-indexes.xml:
<datastore-index kind="Flight" ancestor="true">
<property name="keyName" direction="desc"/>
</datastore-index>
<datastore-index kind="Flight" ancestor="true" source="manual">
<property name="keyName" direction="asc"/>
</datastore-index>
<datastore-index kind="Flight" ancestor="true">
<property name="userCode" direction="desc"/>
</datastore-index>
<datastore-index kind="Flight" ancestor="true" source="manual">
<property name="userCode" direction="asc"/>
</datastore-index>
<datastore-index kind="Flight" ancestor="true">
<property name="name" direction="desc"/>
</datastore-index>
<datastore-index kind="Flight" ancestor="true" source="manual">
<property name="name" direction="asc"/>
</datastore-index>
I have all my indexes in serving status
When I order my Test List works fine with "userCode" and "name" but with "keyName" doesn't, any help?
Upvotes: 0
Views: 232
Reputation: 80340
You should read about Key Filters. By default GAE already has an ascending index on keys, so no need to build one. For descending index on keys try this:
<datastore-index kind="Flight" ancestor="true">
<property name="__key__" direction="desc"/>
</datastore-index>
Upvotes: 1