首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >使用未指定的索引。考虑添加".indexOn":"g“

使用未指定的索引。考虑添加".indexOn":"g“
EN

Stack Overflow用户
提问于 2015-01-21 13:12:36
回答 1查看 18.5K关注 0票数 21

我正在使用Geofire在某个区域执行circleQuery。通过设置我的观察者,我返回了位置,但是,位置也返回了一个“使用未指定的索引。请考虑添加".indexOn":"g"”

我的geofire数据库如下所示: karmadots/geofire/{events}

"rules": {
  "karmadots": {
    ".read": true,
    ".write": true, 
    "geofire": {
      "$events": {
        ".indexOn": ["g"]
      }
    }   
  }

我也尝试过:

"rules": {
  "karmadots": {
    ".read": true,
    ".write": true,
    "geofire": {
      ".indexOn": ["g"]
    } 
  }
}

两者都不会让消息消失。还有没有其他东西我可以试着读一读,或者作为一个例子?

谢谢你的帮助。

编辑:

我的路径是xxxxx.firebaseio.com/karmadots/geofire/{key}

我是这样查询的:

func setupListeners(query: GFQuery){

    // Event is in initial area or entered area
    query.observeEventType(GFEventTypeKeyEntered, withBlock: { (key: String!, location: CLLocation!) in
        println("Key '\(key)' entered the search area and is at location '\(location)'\n")
    })

    // Event left area
    query.observeEventType(GFEventTypeKeyExited, withBlock: { (key: String!, location: CLLocation!) in
        println("Key '\(key)' left the search area\n")
    })

    // Event moved but is still in area
    query.observeEventType(GFEventTypeKeyMoved, withBlock: { (key: String!, location: CLLocation!) in
        println("Key '\(key)' moved in the search area and is at location '\(location)'\n")
    })

}
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28060069

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档