Permalink
Browse files

fixed non textual radius search

  • Loading branch information...
1 parent 0f53b4a commit e30f863b430de482a715ec02d663844b8a13bfdc dvir volk committed Jul 5, 2012
Showing with 5 additions and 4 deletions.
  1. +3 −3 src/city.py
  2. +2 −1 src/index.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)
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:

0 comments on commit e30f863

Please sign in to comment.