tile38/internal/server
Mike Poindexter 2a4272c95f Improve kNN behavior
The current KNN implementation has two areas that can be improved:

- The current behavior is somewhat incorrect. When performing a kNN
query, the current code fetches k items from the index, and then sorts
these items according to Haversine distance. The problem with this
approach is that since the items fetched from the index are ordered by
a Euclidean metric, there is no guarantee that item k + 1 is not closer
than item k in great circle distance, and hence incorrect results can be
returned when closer items beyond k exist.

- The secondary sort is a performance killer. This requires buffering
all k items (again...they were already run through a priority queue in)
the index, and then a sort. Since the items are mostly sorted, and
Go's sort implementation is a quickSort this is the worst case for the
sort algorithm.

Both of these can be fixed by applying a proper distance metric in
the index nearby operation. In addition, this cleans up the code
considerably, removing a number of special cases that applied only
to NEARBY operations.

This change implements a geodetic distance metric that ensures that
the order from the index is correct, eliminating the need for the
secondary sort and special filtering cases in the ScanWriter code.
2020-04-07 20:10:58 -07:00
..
aof.go Code cleanup 2019-10-30 10:17:59 -07:00
aofmigrate.go Code cleanup 2019-10-30 10:17:59 -07:00
aofshrink.go Fixed panic on AOFSHRINK 2019-11-17 07:25:25 -07:00
atomic.go Removed unused atomics 2018-11-23 01:39:04 -07:00
atomic_test.go Replaced net package with evio 2018-10-28 15:51:47 -07:00
bson.go Replaced net package with evio 2018-10-28 15:51:47 -07:00
checksum.go Code cleanup 2019-10-30 10:17:59 -07:00
client.go Code cleanup 2019-10-30 10:17:59 -07:00
config.go Code cleanup 2019-10-30 10:17:59 -07:00
crud.go Avoid sorting fields for each written object. 2020-03-03 13:39:43 -08:00
dev.go Code cleanup 2019-10-30 10:17:59 -07:00
expire.go Code cleanup 2019-10-30 10:17:59 -07:00
expression.go Code cleanup 2019-10-30 10:17:59 -07:00
fence.go Stable sort roam notifications 2020-03-25 13:01:11 -07:00
follow.go Fix a concurrent write/read on the server conn map 2020-03-20 16:47:13 -07:00
hooks.go Code cleanup 2019-10-30 10:17:59 -07:00
json.go Code cleanup 2019-10-30 10:17:59 -07:00
json_test.go Code cleanup 2019-10-30 10:17:59 -07:00
keys.go Code cleanup 2019-10-30 10:17:59 -07:00
live.go Fix invalid pubsub format for json output 2019-10-28 12:51:44 -07:00
output.go Code cleanup 2019-10-30 10:17:59 -07:00
pubsub.go Code cleanup 2019-10-30 10:17:59 -07:00
readonly.go Code cleanup 2019-10-30 10:17:59 -07:00
respconn.go Replaced net package with evio 2018-10-28 15:51:47 -07:00
scan.go Code cleanup 2019-10-30 10:17:59 -07:00
scanner.go Improve kNN behavior 2020-04-07 20:10:58 -07:00
scripts.go Code cleanup 2019-10-30 10:17:59 -07:00
search.go Improve kNN behavior 2020-04-07 20:10:58 -07:00
server.go Match geometry indexing to server config 2020-03-25 15:35:31 -07:00
stats.go Code cleanup 2019-10-30 10:17:59 -07:00
stats_cpu.go Fix go vet error in stats_cpu.go for non-linux/darwin builds 2019-10-28 22:39:27 -03:00
stats_cpu_darlin.go Code cleanup 2019-10-30 10:17:59 -07:00
test.go Match geometry indexing to server config 2020-03-25 15:35:31 -07:00
token.go Code cleanup 2019-10-30 10:17:59 -07:00
token_test.go Replaced net package with evio 2018-10-28 15:51:47 -07:00