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

Using an unspecified index. Consider adding ".indexOn": "g"

我正在使用 Geofire 在特定区域进行 circleQuery。随着我的观察者的设置,我得到了位置,但是,我也得到了位置 "Using an unspecified index. Consider adding ".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/{keys}

我是这样查询的:

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")
    })

}

删除 ["g"] 周围的括号可以解决问题。这是最后一段代码:

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