Skip to content

Commit

Permalink
fix searchable index in loadpoliticaldata
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Levinger committed Aug 24, 2022
1 parent 5c1f451 commit e4d3e2e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions call_server/political_data/countries/us.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,12 @@ def load_data(self):
# if cache is redis, add lexigraphical index on states, names
if hasattr(self._cache, 'cache') and isinstance(self._cache.cache, flask_caching.backends.rediscache.RedisCache):
redis = self._cache.cache._write_client
searchable_items = legislators.items() + governors.items()
for (key,record) in searchable_items:
for sorted_key in self.SORTED_SETS:
if key.startswith(sorted_key):
redis.zadd(sorted_key, key, 0)
searchable_items = [legislators.items(), governors.items()]
for item in searchable_items:
for (key, value) in item:
for sorted_key in self.SORTED_SETS:
if key.startswith(sorted_key):
redis.zadd(sorted_key, {key: 0})

success = [
"%s zipcodes" % len(districts),
Expand Down

0 comments on commit e4d3e2e

Please sign in to comment.