geodis icon indicating copy to clipboard operation
geodis copied to clipboard

Passing store=False seems to store

Open jhorman opened this issue 9 years ago • 2 comments

Trying to follow the flow here.

https://github.com/EverythingMe/geodis/blob/master/geodis/index.py#L228

            if not store:
                redisConn.zunionstore(tmpKey, list(closest))
                return redisConn.zrevrange(tmpKey, 0, -1, withscores=True)
            else:
                return list(closest)

It looks like if I don't want to store anything, I should pass store=True

jhorman avatar Jun 08 '15 23:06 jhorman

Thanks, I've written this code so long ago, I'll need to do some diving in, but ACK

dvirsky avatar Jun 09 '15 07:06 dvirsky

My issue was 100's of megabytes of stored keys for lat/lon. I ended up with the following, to avoid the storage.

p = redis.pipeline(False)
all_city_ids = set()
union_keys = cls._keys['geoname'].getIds(redis, lat=lat, lon=lon, radius=radius, store=True)
for union_key in union_keys:
  p.zrange(union_key, 0, -1)
for city_ids in p.execute():
  all_city_ids.update(city_ids)

getIds(store=True) returns set names that need to be unioned in memory instead of in redis.

jhorman avatar Jun 12 '15 17:06 jhorman