【问题标题】:admin console GQL query: index not found when ordering on date管理控制台 GQL 查询:按日期订购时未找到索引
【发布时间】:2012-08-02 21:16:42
【问题描述】:

我的 datastore-indexes.xml 如下所示:

<datastore-index kind="Book" ancestor="false" source="auto">
    <property name="^i" direction="asc"/>
    <property name="nurInRange2" direction="asc"/>
    <property name="firstModificationDate" direction="desc"/>
</datastore-index>

数据存储管理控制台实际上在数据/数据存储索引下显示了这一点:

^i ▲ , nurInRange2 ▲ , firstModificationDate ▼ : serving

但是,当我转到数据存储查看器并执行 by gql 查询时:

SELECT * FROM Book where nurInRange2 = True  order by firstModificationDate DESC

我收到以下回复:

no matching index found.
The suggested index for this query is:
    - kind: Book
    properties:
      - name: nurInRange5
      - name: firstModificationDate
        direction: desc

我有什么明显的遗漏吗?我的索引公式有什么问题吗?

【问题讨论】:

  • 什么是 ^i 属性(在索引中)为什么它在那里?它不是建议索引的一部分。你需要一个没有它的新索引。
  • @Shay: ^i 属性(很可能)是 Objectify 生成的属性,需要多态性:code.google.com/p/objectify-appengine/wiki/…
  • 10x @PeterKnego 我从未使用过 Objectify。

标签: google-app-engine google-cloud-datastore gql gqlquery


【解决方案1】:

如果要对其进行排序,则必须在过滤器中使用“firstModificationDate”。

请参阅Restrictions on Queries 了解更多信息。

【讨论】:

    猜你喜欢
    • 2010-12-20
    • 1970-01-01
    • 2012-02-09
    • 1970-01-01
    • 2021-04-29
    • 2013-03-10
    • 2021-06-09
    • 2016-08-19
    • 1970-01-01
    相关资源
    最近更新 更多