Commit Graph

25 Commits

Author SHA1 Message Date
tidwall 579a41abae Merge branch 'housecanary-fix-knn' 2021-07-11 10:02:59 -07:00
Josh 1467cba769
Merge pull request #552 from rshura/clip-by
Add CLIPBY subcommand to INTERSECTS/WITHIN
2021-07-10 09:24:57 -07:00
tidwall 6b08f7fa9e Code cleanup
- Removed unused functions and variables
- Wrapped client formatted errors
- Updated deprecated packages
- Changed suggested code patterns
2021-03-31 08:13:44 -07:00
tidwall 40105e6b7e Include "distance" to output when user specifically requests
fixes #599
2021-03-30 11:49:01 -07:00
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
Alex Roitman 34cb2affdc Add clipby subcommand to INTERSECTS/WITHIN 2020-04-03 16:49:06 -07:00
tidwall ff48054d3d Fixed a missing faraway event for roaming geofences
This commit fixes a case where a roaming geofence will not fire
a "faraway" event when it's supposed to.

The fix required rewriting the nearby/faraway detection logic. It
is now much more accurate and takes overall less memory, but it's
also a little slower per operation because each object proximity
is checked twice per update. Once to compare the old object's
surrounding, and once to evaulated the new object. The two lists
are then used to generate accurate "nearby" and "faraway" results.
2020-03-22 11:54:56 -07:00
tidwall aedd972516 Fixed invalid count for nearby queries
closes #489
2019-08-22 15:53:37 -07:00
Alex Roitman cbf10b7472 Rework timeouts to allow prepending any command with the TIMEOUT seconds 2019-04-25 14:15:53 -07:00
Alex Roitman e514a0287f Add timeout subcommand to scan/search commands.
Use per-query timeout for those commands, if it was given.
2019-04-24 12:02:39 -07:00
tidwall 0aecef6a5c Added TIMEOUT command 2019-04-24 05:09:41 -07:00
tidwall fc3e8b4359 Fix nearby with match query invalid results
closes #421
2019-03-01 06:55:26 -07:00
Alex Roitman f7ba43360e Typo in error messages 2019-02-08 13:56:07 -08:00
Steve Lacy 1a8993feaf
Add RequireValid env variable and parse options 2019-01-10 09:36:58 -07:00
tidwall 07bae979a5 Added Cursor interface 2018-11-02 06:09:56 -07:00
Josh Baker 0ea2ec216c
Merge pull request #378 from rshura/fast_cursor
Fast cursor
2018-11-02 05:14:53 -07:00
tidwall a4986d9cf8 Removed unneeded params 2018-11-02 05:09:51 -07:00
Alex Roitman 0933c541f4 Refactor cursor/paging. 2018-10-31 22:01:37 -07:00
Alex Roitman b94f3685b6 Move iterating up to the cursor before any tests. 2018-10-31 22:01:24 -07:00
Alex Roitman f45d81d692 Simplification 2018-10-31 01:30:10 -07:00
Alex Roitman d2c687d61e camelCase 2018-10-31 00:45:16 -07:00
Alex Roitman 63b41691e6 Clean up obsolete code. 2018-10-31 00:40:09 -07:00
Alex Roitman 18d7398d50 Minor refactoring 2018-10-29 18:18:04 -07:00
Alex Roitman 2383594048 Use haversine instead of distance in knn if distance is not required. 2018-10-29 15:32:47 -07:00
tidwall 555e47036c Replaced net package with evio
- Added threads startup flag
- Replaced net package with evio
- Refactored controller into server
2018-10-28 15:51:47 -07:00