使用未指定的索引。考虑添加“.indexOn”:“g” [英] Using an unspecified index. Consider adding ".indexOn": "g"
问题描述
我正在使用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/{keys}
这就是我查询:
pre $ func setupListeners查询GFQuery {
//事件在初始区域或输入区域
在
println(Key'\(key)')中输入查询区域的query.observeEventType(GFEventTypeKeyEntered,withBlock:{(key:String !, location:CLLocation!位置'\(位置)'\\\
)
})
//事件左边区域
query.observeEventType(GFEventTypeKeyExited,withBlock:{(key:String! (位置:CLLocation!)in
println(Key'\(key)'left the search area \\\
)
})
//事件已移动但仍然在
中
query.observeEventType(GFEventTypeKeyMoved,withBlock:{(key:String!,location:CLLocation!)in
println(Key'\(key)'移到搜索区域的位置'\(location)'\\\
)
})
}
移除[g]的括号可以解决问题。这是最后一段代码:
rules:{
karmadots:{
.read:true,
.write:true,
geofire:{$ b $.indexOn:g
}
}
}
I'm using Geofire to do a circleQuery in a certain area. With my observers set up I am getting back locations, however, with the location I also get back a "Using an unspecified index. Consider adding ".indexOn": "g""
My db for my geofire looks like this karmadots/geofire/{events}
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
"$events": {
".indexOn": ["g"]
}
}
}
I've also tried:
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
".indexOn": ["g"]
}
}
}
Both don't make the message go away. Is there something else I can try reading or try as an example?
Thanks for the help.
EDIT:
My path is xxxxx.firebaseio.com/karmadots/geofire/{keys}
This is how I query:
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")
})
}
Removing the brackets around ["g"] fixes the problem. Here is the final piece of code:
"rules": {
"karmadots": {
".read": true,
".write": true,
"geofire": {
".indexOn": "g"
}
}
}
这篇关于使用未指定的索引。考虑添加“.indexOn”:“g”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!