Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed non textual radius search

  • Loading branch information...
commit 97125ab090eb49b0df0bb3a70b01e0d7ae04ab2f 1 parent 3de109d
dvir volk authored Dvir Volk committed
Showing with 5 additions and 4 deletions.
  1. +3 −3 src/city.py
  2. +2 −1  src/index.py
6 src/city.py
View
@@ -136,10 +136,10 @@ def getByRadius(cls, lat, lon, radius, redisConn, text = None, limit = 5):
lon = -0.1
#lat,lon = 32.0667,34.7667
- d = 128
+ d = 100
st = time.time()
- #cities = City.getByRadius(lat, lon, d, r, "haifa")
- cities = City.getByName('new york', r, lat, lon)
+ cities = City.getByRadius(lat, lon, d, r, "luton")
+ #cities = City.getByName('new york', r, lat, lon)
et = time.time()
print 1000*(et - st),"ms"
print "Found %d cities!" % len(cities)
3  src/index.py
View
@@ -256,7 +256,8 @@ def getIds(self, redisConn, lat, lon, radius, text = ''):
if not text:
ids = self.geoIndex.getIds(redisConn, lat, lon, radius, False)
- nodes = filter(lambda c: c and Location.getLatLonDistance((lat, lon), c[1]) <= radius, ids)
+
+ nodes = filter(lambda c: c and Location.getLatLonDistance((lat, lon), c[1]) <= radius, ((x[0], hasher.decode(long(x[1]))) for x in ids))
return [id[0] for id in ids]
else:
Please sign in to comment.
Something went wrong with that request. Please try again.