我对 GAE java 上的 DataStore 查询的问题感到困惑——它总是抱怨我没有匹配的索引,即使我有他们在我的 datastore-indexes.xml 中建议的确切索引——可以摆脱一些在我拉出所有头发之前点亮?
com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found.
The suggested index for this query is:
<datastore-index kind="Users" ancestor="false" source="manual">
<property name="BILLING_ENABLED" direction="asc"/>
<property name="EXPIRED" direction="asc"/>
<property name="api" direction="asc"/>
<property name="CREATION" direction="asc"/>
</datastore-index>
我的数据存储索引.xml
<datastore-indexes autoGenerate="true">
<datastore-index kind="Users" ancestor="false" source="manual">
<property name="BILLING_ENABLED" direction="asc"/>
<property name="EXPIRED_DATE" direction="asc"/>
<property name="EXPIRED" direction="asc"/>
<property name="api" direction="asc"/>
<property name="CREATION" direction="asc"/>
</datastore-index>
</datastore-indexes>
我的查询:
查询 q = new Query("Users"); 过滤器过滤器 = CompositeFilterOperator.and(new FilterPredicate("api", Query.FilterOperator.EQUAL, "val"), new FilterPredicate(EXPIRED, Query.FilterOperator.EQUAL, Boolean.FALSE)); filter = CompositeFilterOperator.and(filter, new FilterPredicate("BILLING_ENABLED", Query.FilterOperator.EQUAL, Boolean.FALSE)); filter = CompositeFilterOperator.and(filter, new FilterPredicate("CREATION", Query.FilterOperator.LESS_THAN_OR_EQUAL, cal.getTime()));
如果我理解正确,我需要“api”、“EXPIRED”、“BILLING_ENABLED”和“CREATION”的索引,因为它们在查询中使用——但我还需要什么吗?
谢谢,阿德里安