From e4d3e2ec3a44d8e036b521a95ae91ed3cc833e47 Mon Sep 17 00:00:00 2001 From: Josh Levinger Date: Wed, 24 Aug 2022 13:01:30 -0700 Subject: [PATCH] fix searchable index in loadpoliticaldata --- call_server/political_data/countries/us.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/call_server/political_data/countries/us.py b/call_server/political_data/countries/us.py index 7807bbcf..40e5106b 100644 --- a/call_server/political_data/countries/us.py +++ b/call_server/political_data/countries/us.py @@ -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),