0

datastore-indexesにキーを追加するためのいくつかの制限がありますか?

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

そして私の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>

すべてのインデックスがサービスステータスになっています

テストリストを注文すると、「userCode」と「name」では正常に機能しますが、「keyName」では機能しません。

4

1 に答える 1

1

Key Filtersについて読む必要があります。デフォルトでは、GAE はすでにキーに昇順のインデックスを持っているので、作成する必要はありません。キーの降順インデックスについては、これを試してください:

<datastore-index kind="Flight" ancestor="true">
    <property name="__key__" direction="desc"/>
</datastore-index>
于 2012-09-05T11:04:39.737 に答える