【问题标题】:Ordering with filter in Google app engine data store在 Google 应用引擎数据存储中使用过滤器进行排序
【发布时间】:2012-08-21 10:29:53
【问题描述】:

Google DataStore 中,我使用了按一个属性排序并按其他属性过滤。但 Datastore 抛出异常。

假设我过滤了名字的属性并按创建日期排序

String firstname = "Smith";
query.setFilter("firstname == :1");
query.setOrdering("creationdate desc");
query.execute(firstname)

它不工作。

【问题讨论】:

  • 你遇到了什么异常?
  • Java 异常(我假设您在这里使用 Java)通常描述了您需要添加到 datastore-indexes.xml 以正确执行查询的复合索引。请检查您的日志或控制台。

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


【解决方案1】:

过去我在处理多个属性时遇到了异常;有人建议我使用索引。看看有没有帮助

https://developers.google.com/appengine/docs/java/config/indexconfig

【讨论】:

  • 我收到以下错误The first sort property must be the same as the property to which the inequality filter is applied. In your query the first sort property is creationdate but the inequality filter is on firstname.
猜你喜欢
  • 2023-04-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-04-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多