Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing store=False seems to store #13

Open
jhorman opened this issue Jun 8, 2015 · 2 comments
Open

Passing store=False seems to store #13

jhorman opened this issue Jun 8, 2015 · 2 comments
Assignees

Comments

@jhorman
Copy link

jhorman commented Jun 8, 2015

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 jhorman changed the title Issues with indexing Passing store=False seems to store Jun 8, 2015
@dvirsky
Copy link
Member

dvirsky commented Jun 9, 2015

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

@dvirsky dvirsky self-assigned this Jun 9, 2015
@jhorman
Copy link
Author

jhorman commented Jun 12, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants