google-app-engine - 我的数据存储在 appspot 上没有索引条目?

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

首先我创建一个 index.yaml

- kind: Tarifa 2014
  ancestor: yes
  properties:
  - name: Date
    direction: desc

- kind: Tarifa 2014
  ancestor: yes
  properties:
  - name: Division
  - name: Heat
  - name: Date
    direction: desc

然后我把一些数据放进去

key := datastore.NewKey(s.Context, "Tarifa 2014", "", 0, s.Root)
key, err = datastore.Put(s.Context, key, m)

简单的查询工作,

key := datastore.NewKey(s.Context, "Tarifa 2014", "", id, s.Root)
err = datastore.Get(s.Context, key, &m)

但这不是因为我的索引仍然是空的吗?

datastore.NewQuery(e).Ancestor(s.Root).Filter("Division =", d).Filter("Heat =", h).Order("-Date")

同样如此,也行不通?

datastore.NewQuery(e).Ancestor(s.Root).Order("-Date")

我在 appspot.com 上的索引看起来像这样?

enter image description here

我的数据存储在 appspot.com 上看起来像这样

enter image description here

请注意,在 localhost:8080 上所有查询都工作正常?

最佳答案

由于不清楚的原因,如果我使用 Namespace ,索引查询会在 appspot.com 上中断

c2 := endpoints.NewContext(r)
c, err := appengine.Namespace(c2, "")
if err != nil {return err}

您需要在没有命名空间的情况下直接使用端点上下文。

c := endpoints.NewContext(r)

关于google-app-engine - 我的数据存储在 appspot 上没有索引条目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24595487/

相关文章:

go - 我如何绕过没有参数多态性的 Go?

pointers - Golang指针反向链表混淆

python - 无法在 Google App Engine (Python) 中显示图像

maven - Google App Engine - 未在 appengine-web.xml 中读取 pom.xml 中的参数

java - 将 xml 文件上传到 Google Cloud Storage 时出现错误

python - 数据库错误: Lookup type 'in' can't be negated

go - 添加 gokogiri 依赖导致 `Killed: 9` 退出

testing - 谷歌数据存储模拟器

java - 使用或不使用 GAE 存储超过 500 个字符的字符串/文本值

google-app-engine - 删除表