Skip to content

Commit

Permalink
fixed non textual radius search
Browse files Browse the repository at this point in the history
  • Loading branch information
dvir volk committed Jul 5, 2012
1 parent 0f53b4a commit e30f863
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/city.py
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/index.py
Expand Up @@ -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:

Expand Down

0 comments on commit e30f863

Please sign in to comment.