Add GEOSEARCH/GEOSEARCHSTORE command#8094
Conversation
d343474 to
472d0fb
Compare
fce6a1d to
075c65c
Compare
itamarhaber
left a comment
There was a problem hiding this comment.
Haven't completed my review yet, but here're a couple of trivialities. Also, looks like some of the additions go well beyond 80-characters-per-line unwritten style guide.
075c65c to
438bee4
Compare
oranagra
left a comment
There was a problem hiding this comment.
@yangbodong22011 thank you for this PR.
I think i've reviewed most of the code (excluding the tests).
i have many comments, but i guess the most important one to address to consider if both geohashGetDistanceIfInRectangle is considering the box inside the radius or the one bound is.
hope i'm not talking nonsense.. i didn't study the topic enough and i have to move on. hope you can dismiss my concerns one way or another.
|
@oranagra Thanks for your review, follow this tcl case, my original idea is as follows:
Q: How to determine that a point is within the axis-aligned rectangle? If the coordinates of this point are greater than the minimum latitude and longitude and less than the maximum latitude and longitude. After you suggest that you should use height/2, width/2, I think your opinion is correct and logical. So in order to reach the search range of the above pictures, the new parameters are as follows: Is that right? |
|
@yangbodong22011 yes, width and height of that box are 400. i'm not aware of a word in English that describes half the width (other than saying |
438bee4 to
05f52b7
Compare
|
updated:
@oranagra I will close some of the comments in your previous comments, please review again when you have time. |
05f52b7 to
2d0f6aa
Compare
oranagra
left a comment
There was a problem hiding this comment.
@yangbodong22011 thank you.
can you tell me something about the tests coverage and what was your approach when creating them?
i.e. did you duplicate some of the GEORADIUS tests and changed them to use GEOSEARCH?
I see you attempted to cover some of the syntax errors, but did you also try to test some box specific points? (i.e. search for points that are outside a circle but inside a big that has similar "radius")?
or trying to create odd box shapes (non square ones)?
|
@redis/core-team please approve the new commands and their syntax. |
e77f076 to
30bd158
Compare
refer: redis#4417 GEOSEARCH key [FROMMEMBER member] [FROMLOC long lat] [BYRADIUS radius unit] [BYBOX width height unit] [WITHCORD] [WITHDIST] [WITHASH] [COUNT count] [ASC|DESC] GEOSEARCHSTORE dest_key src_key [FROMMEMBER member] [FROMLOC long lat] [BYRADIUS radius unit] [BYBOX width height unit] [WITHCORD] [WITHDIST] [WITHASH] [COUNT count] [ASC|DESC] [STOREDIST] - Add two types of CIRCULAR_TYPE and RECTANGLE_TYPE to achieve different searches - Judge whether the point is within the rectangle, refer to: geohashGetDistanceIfInRectangle
5c77e6c
30bd158 to
5c77e6c
Compare
|
@yangbodong22011 can you please also make a redis-doc PR for this? |
sure, I will do it. |
Add commands to query geospatial data with bounding box. Two new commands that replace the existing 4 GEORADIUS* commands. GEOSEARCH key [FROMMEMBER member] [FROMLOC long lat] [BYRADIUS radius unit] [BYBOX width height unit] [WITHCORD] [WITHDIST] [WITHASH] [COUNT count] [ASC|DESC] GEOSEARCHSTORE dest_key src_key [FROMMEMBER member] [FROMLOC long lat] [BYRADIUS radius unit] [BYBOX width height unit] [WITHCORD] [WITHDIST] [WITHASH] [COUNT count] [ASC|DESC] [STOREDIST] - Add two types of CIRCULAR_TYPE and RECTANGLE_TYPE to achieve different searches - Judge whether the point is within the rectangle, refer to: geohashGetDistanceIfInRectangle

refer: #4417
Syntax:
searches
geohashGetDistanceIfInRectangle