mirror of https://github.com/tidwall/tile38.git
parent
54f14d8b03
commit
aedd972516
|
@ -409,7 +409,6 @@ func (server *Server) nearestNeighbors(
|
||||||
iter func(id string, o geojson.Object, fields []float64, dist float64,
|
iter func(id string, o geojson.Object, fields []float64, dist float64,
|
||||||
) bool) {
|
) bool) {
|
||||||
maxDist := target.Haversine()
|
maxDist := target.Haversine()
|
||||||
limit := int(sw.limit)
|
|
||||||
var items []iterItem
|
var items []iterItem
|
||||||
sw.col.Nearby(target, sw, dl, func(id string, o geojson.Object, fields []float64) bool {
|
sw.col.Nearby(target, sw, dl, func(id string, o geojson.Object, fields []float64) bool {
|
||||||
if server.hasExpired(s.key, id) {
|
if server.hasExpired(s.key, id) {
|
||||||
|
@ -427,7 +426,7 @@ func (server *Server) nearestNeighbors(
|
||||||
if !keepGoing {
|
if !keepGoing {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return len(items) < limit
|
return uint64(len(items)) < sw.limit
|
||||||
})
|
})
|
||||||
sort.Slice(items, func(i, j int) bool {
|
sort.Slice(items, func(i, j int) bool {
|
||||||
return items[i].dist < items[j].dist
|
return items[i].dist < items[j].dist
|
||||||
|
|
Loading…
Reference in New Issue