Fix nearby fast-fail

This commit is contained in:
tidwall 2018-11-11 06:26:23 -07:00
parent a160fa0860
commit b2203fcb97
1 changed files with 4 additions and 4 deletions

View File

@ -674,9 +674,9 @@ func (c *Collection) Nearby(
cursor Cursor,
iter func(id string, obj geojson.Object, fields []float64) 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 {
meters := circle.Meters()
if meters > 0 {
center := circle.Center()
@ -692,12 +692,12 @@ func (c *Collection) Nearby(
},
)
if !exists {
return true
}
// no candidates
return true
}
}
}
// do the kNN operation
alive := true
center := target.Center()
var count uint64