From 2cc8c48ec8b5b9f66e94d779abb4095eca96c87c Mon Sep 17 00:00:00 2001 From: AnneY Date: Thu, 29 Sep 2022 21:04:10 +0800 Subject: [PATCH 1/3] Add to_string method for GeoValue --- redis/commands/search/querystring.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/redis/commands/search/querystring.py b/redis/commands/search/querystring.py index 1da0387eb8..0d2e38fc51 100644 --- a/redis/commands/search/querystring.py +++ b/redis/commands/search/querystring.py @@ -131,6 +131,14 @@ def __init__(self, lon, lat, radius, unit="km"): self.lat = lat self.radius = radius self.unit = unit + + def to_string(self): + return "[{0} {1} {2} {3}]".format( + self.lon, + self.lat, + self.radius, + self.unit + ) class Node: From 916a86434ee478ff19e325c51b865dcec533299f Mon Sep 17 00:00:00 2001 From: AnneY Date: Thu, 29 Sep 2022 21:24:38 +0800 Subject: [PATCH 2/3] fix code style --- redis/commands/search/querystring.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redis/commands/search/querystring.py b/redis/commands/search/querystring.py index 0d2e38fc51..7ea602b97d 100644 --- a/redis/commands/search/querystring.py +++ b/redis/commands/search/querystring.py @@ -131,7 +131,7 @@ def __init__(self, lon, lat, radius, unit="km"): self.lat = lat self.radius = radius self.unit = unit - + def to_string(self): return "[{0} {1} {2} {3}]".format( self.lon, From 85eac651df206b62b20e5cc716da7f3fde54e396 Mon Sep 17 00:00:00 2001 From: AnneY Date: Thu, 29 Sep 2022 22:15:05 +0800 Subject: [PATCH 3/3] simplify code --- redis/commands/search/querystring.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/redis/commands/search/querystring.py b/redis/commands/search/querystring.py index 7ea602b97d..3ff1320972 100644 --- a/redis/commands/search/querystring.py +++ b/redis/commands/search/querystring.py @@ -133,12 +133,7 @@ def __init__(self, lon, lat, radius, unit="km"): self.unit = unit def to_string(self): - return "[{0} {1} {2} {3}]".format( - self.lon, - self.lat, - self.radius, - self.unit - ) + return f"[{self.lon} {self.lat} {self.radius} {self.unit}]" class Node: