diff options
Diffstat (limited to 'data/updateRecords.py')
-rw-r--r-- | data/updateRecords.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/data/updateRecords.py b/data/updateRecords.py new file mode 100644 index 0000000..f8327b2 --- /dev/null +++ b/data/updateRecords.py @@ -0,0 +1,18 @@ +from algoliasearch.search_client import SearchClient +from dotenv import load_dotenv +import os + +INDEX_NAME = 'pubfinder' + +client = SearchClient.create(os.getenv('ALG_APPLICATION_ID'), os.getenv('ALG_API_KEY')) +index = client.init_index(INDEX_NAME) + +for record in index.browse_objects({"filters": "borough:'City of London'"}): + _geoloc = { + "lat": record["lat"], + "lng": record["lng"] + } + record["_geoloc"] = _geoloc + del record["lat"] + del record["lng"] + index.save_object(record) |