Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: georadius should return empty set if the key does not exist #845

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/redis_geo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ rocksdb::Status Geo::Radius(const Slice &user_key,
AppendNamespacePrefix(user_key, &ns_key);
ZSetMetadata metadata(false);
rocksdb::Status s = ZSet::GetMetadata(ns_key, &metadata);
if (!s.ok()) return s;
if (!s.ok()) return s.IsNotFound() ? rocksdb::Status::OK() : s;

/* Get all neighbor geohash boxes for our radius search */
GeoHashRadius georadius = GeoHashHelper::GetAreasByRadiusWGS84(longitude, latitude, radius_meters);
Expand Down
5 changes: 5 additions & 0 deletions tests/tcl/tests/unit/geo.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,11 @@ start_server {tags {"geo"}} {
set e
} {*syntax*}

test {GEORADIUS missing key} {
r del points
assert_equal {} [r georadius points 13.361389 38.115556 50 km]
}

# test {GEOSEARCHSTORE STORE option: syntax error} {
# catch {r geosearchstore abc points fromlonlat 13.361389 38.115556 byradius 50 km store abc} e
# set e
Expand Down