mirror of https://github.com/tidwall/tile38.git
Fix nearby fast-fail
This commit is contained in:
parent
a160fa0860
commit
b2203fcb97
|
@ -674,9 +674,9 @@ func (c *Collection) Nearby(
|
||||||
cursor Cursor,
|
cursor Cursor,
|
||||||
iter func(id string, obj geojson.Object, fields []float64) bool,
|
iter func(id string, obj geojson.Object, fields []float64) bool,
|
||||||
) bool {
|
) bool {
|
||||||
|
// First look to see if there's at least one candidate in the circle's
|
||||||
|
// outer rectangle. This is a fast-fail operation.
|
||||||
if circle, ok := target.(*geojson.Circle); ok {
|
if circle, ok := target.(*geojson.Circle); ok {
|
||||||
|
|
||||||
meters := circle.Meters()
|
meters := circle.Meters()
|
||||||
if meters > 0 {
|
if meters > 0 {
|
||||||
center := circle.Center()
|
center := circle.Center()
|
||||||
|
@ -692,12 +692,12 @@ func (c *Collection) Nearby(
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if !exists {
|
if !exists {
|
||||||
return true
|
// no candidates
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// do the kNN operation
|
||||||
alive := true
|
alive := true
|
||||||
center := target.Center()
|
center := target.Center()
|
||||||
var count uint64
|
var count uint64
|
||||||
|
|
Loading…
Reference in New Issue