summaryrefslogtreecommitdiff
path: root/src/geo.c
Commit message (Collapse)AuthorAgeFilesLines
* RDMF: use client instead of redisClient, like Disque.antirez2015-07-261-11/+11
|
* GEOENCODE / GEODECODE commands removed.antirez2015-07-091-93/+0
| | | | | | | | | | | | | Rationale: 1. The commands look like internals exposed without a real strong use case. 2. Whatever there is an use case, the client would implement the commands client side instead of paying RTT just to use a simple to reimplement library. 3. They add complexity to an otherwise quite straightforward API. So for now KILLED ;-)
* Geo: -Ofast breaks builds on older GCCs.antirez2015-07-091-1/+1
|
* Geo: validate long,lat passed by user via APIantirez2015-07-061-0/+6
|
* Geo: sync faster decoding from krtm that synched from Ardb.antirez2015-07-011-1/+1
| | | | | | Instead of successive divisions in iteration the new code uses bitwise magic to interleave / deinterleave two 32bit values into a 64bit one. All tests still passing and is measurably faster, so worth it.
* Geo: added my copyright notice in modified files.geoantirez2015-06-291-0/+1
|
* Geo: support units only in abbreviated form.antirez2015-06-291-7/+7
| | | | | I'm not a strong believer in multiple syntax for the same stuff, so now units can be specified only as m, km, ft, mi.
* Geo: remove static declarations.antirez2015-06-291-6/+6
| | | | | | | | | | Stack traces produced by Redis on crash are the most useful tool we have to fix non easily reproducible crashes, or even easily reproducible ones where the user just posts a bug report and does not collaborate furhter. By declaring functions "static" they no longer show up in the stack trace.
* Geo: GEODIST and tests.antirez2015-06-291-18/+66
|
* Geo: command function names converted to lowercase, as elsewhere.antirez2015-06-291-9/+9
| | | | | In Redis MULTIWORDCOMMANDNAME are mapped to functions where the command name is all lowercase: multiwordcommandnameCommand().
* Geo: GEOPOS command and tests.antirez2015-06-291-0/+33
|
* Geo: GEOENCODE: fix command arity check.antirez2015-06-291-3/+3
|
* Geo: GEOENCODE now returns score ranges.antirez2015-06-291-9/+22
| | | | | | | | If GEOENCODE must be our door to enter the Geocoding implementation details and do fancy things client side, than return the scores as well so that we can query the sorted sets directly if we wish to do the same search multiple times, or want to compute the boxes in the client side to refine our search needs.
* Geo: fix comment indentation.antirez2015-06-291-1/+1
|
* Geo: debugging printf calls removed.antirez2015-06-291-7/+0
|
* Geo: GEOADD form using radius removed.antirez2015-06-291-19/+5
| | | | | Can't immagine how this is useful in the context of the API exported by Redis, and we are always in time to add more bloat if needed, later.
* Geo: commands top comment as in other Redis code.antirez2015-06-291-12/+7
|
* Geo: COUNT option for GEORADIUS.antirez2015-06-271-2/+20
|
* Geo: only one way to specify any given option.antirez2015-06-271-6/+7
|
* Geo: remove useless variable. geoRadiusGeneric() top comment improved.antirez2015-06-271-8/+4
|
* Geo: from lat,lon API to lon,lat API according to GIS standardantirez2015-06-261-58/+55
| | | | | | | | | | | | | | | The GIS standard and all the major DBs implementing GIS related functions take coordinates as x,y that is longitude,latitude. It was a bad start for Redis to do things differently, so even if this means that existing users of the Geo module will be required to change their code, Redis now conforms to the standard. Usually Redis is very backward compatible, but this is not an exception to this rule, since this is the first Geo implementation entering the official Redis source code. It is not wise to try to be backward compatible with code forks... :-) Close #2637.
* Geo: explain increment magic in membersOfGeoHashBox().antirez2015-06-241-0/+20
|
* Geo: GEOHASH command added, returning standard geohash strings.antirez2015-06-241-0/+55
|
* Geo: Fix geohashEstimateStepsByRadius() step underestimation.antirez2015-06-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The returned step was in some case not enough towards normal coordinates (for example when our search position was was already near the margin of the central area, and we had to match, using the east or west neighbor, a very far point). Example: geoadd points 67.575457940146066 -62.001317572780565 far geoadd points 66.685439060295664 -58.925040587282297 center georadius points 66.685439060295664 -58.925040587282297 200 km In the above case the code failed to find a match (happens at smaller latitudes too) even if far and center are at less than 200km. Another fix introduced by this commit is a progressively larger area towards the poles, since meridians are a lot less far away, so we need to compensate for this. The current implementation works comparably to the Tcl brute-force stress tester implemented in the fuzzy test in the geo.tcl unit for latitudes between -70 and 70, and is pretty accurate over +/-80 too, with sporadic false negatives. A more mathematically clean implementation is possible by computing the meridian distance at the specified latitude and computing the step according to it.
* Geo: return REDIS_* where appropriate, improve commentingantirez2015-06-231-12/+19
|
* Geo: GEOADD implementation improved, replication fixedantirez2015-06-231-37/+28
| | | | | | | 1. We no longer use a fake client but just rewriting. 2. We group all the inserts into a single ZADD dispatch (big speed win). 3. As a side effect of the correct implementation, replication works. 4. The return value of the command is now correct.
* Geo: more x,y renamed lat,lonantirez2015-06-231-8/+8
|
* Geo: rename x,y to lat,lon for clarityantirez2015-06-231-13/+12
|
* Geo: use the high level API to decode in geoAppendIfWithinRadius()antirez2015-06-231-12/+7
|
* Geo: big refactoring of geo.c, zset.[ch] removed.antirez2015-06-231-128/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit simplifies the implementation in a few ways: 1. zsetScore implementation improved a bit and moved into t_zset.c where is now also used to implement the ZSCORE command. 2. Range extraction from the sorted set remains a separated implementation from the one in t_zset.c, but was hyper-specialized in order to avoid accumulating results into a list and remove the ones outside the radius. 3. A new type is introduced: geoArray, which can accumulate geoPoint structures in a vector with power of two expansion policy. This is useful since we have to call qsort() against it before returning the result to the user. 4. As a result of 1, 2, 3, the two files zset.c and zset.h are now removed, including the function to merge two lists (now handled with functions that can add elements to existing geoArray arrays) and the machinery used in order to pass zset results. 5. geoPoint structure simplified because of the general code structure simplification, so we no longer need to take references to objects. 6. Not counting the JSON removal the refactoring removes 200 lines of code for the same functionalities, with a simpler to read implementation. 7. GEORADIUS is now 2.5 times faster testing with 10k elements and a radius resulting in 124 elements returned. However this is mostly a side effect of the refactoring and simplification. More speed gains can be achieved by trying to optimize the code.
* Geo: Pub/Sub feature removedantirez2015-06-221-32/+0
| | | | | | | This feature apparently is not going to be very useful, to send a GEOADD+PUBLISH combo is exactly the same. One that would make a ton of difference is the ability to subscribe to a position and a radius, and get the updates in terms of objects entering/exiting the area.
* Geo: addReplyDoubleDistance() precision set to 4 digitsantirez2015-06-221-6/+8
| | | | | | Also: 1. The function was renamed. 2. An useless initialization of a buffer was removed.
* Geo: JSON features removedantirez2015-06-221-139/+14
| | | | | The command can only return data in the normal Redis protocol. It is up to the caller to translate to JSON if needed.
* Geo: removed bool usage from Geo code inside Redisantirez2015-06-221-26/+27
|
* [In-Progress] Add Geo CommandsMatt Stancliff2015-06-221-0/+749
Current todo: - replace functions in zset.{c,h} with a new unified Redis zset access API. Once we get the zset interface fixed, we can squash relevant commits in this branch and have one nice commit to merge into unstable. This commit adds: - Geo commands - Tests; runnable with: ./runtest --single unit/geo - Geo helpers in deps/geohash-int/ - src/geo.{c,h} and src/geojson.{c,h} implementing geo commands - Updated build configurations to get everything working - TEMPORARY: src/zset.{c,h} implementing zset score and zset range reading without writing to client output buffers. - Modified linkage of one t_zset.c function for use in zset.c Conflicts: src/Makefile src/redis.c