簡體   English   中英

Google App Engine Java-索引和鍵

[英]Google App Engine Java - Indexes and Keys

將鍵添加到數據存儲索引有一些限制嗎?

我有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”一起工作時,可以使用嗎?

您應該閱讀有關鍵過濾器的信息 默認情況下,GAE在鍵上已具有升序索引,因此無需構建鍵。 對於鍵的降序索引,請嘗試以下操作:

<datastore-index kind="Flight" ancestor="true">
    <property name="__key__" direction="desc"/>
</datastore-index>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM