最近商圈

This commit is contained in:
shenjian@fangjia.com
2022-11-16 13:57:17 +08:00
parent 2d9663edf2
commit 1111118797
@@ -69,9 +69,10 @@ def deal(actions, item):
doc_info = dict()
# 商圈
business_district_doc = find_nearest_by_location(curr_city, 10000, [lng, lat])
if pd.notna(business_district_doc):
doc_info['nearest_business_district_distance'] = int(business_district_doc['sort'][0])
doc_info['nearest_business_district'] = business_district_doc['_source']['name']
if pd.isna(business_district_doc):
return
doc_info['nearest_business_district_distance'] = int(business_district_doc['sort'][0])
doc_info['nearest_business_district'] = business_district_doc['_source']['name']
action = {
"_op_type": "update",
@@ -102,7 +103,6 @@ def sync(city=None):
with ThreadPoolExecutor(max_workers=30) as pool:
for index, item in seaweed_df.iterrows():
pool.submit(deal, actions, item)
if len(actions) > 0:
helpers.bulk(es206_client.elastic_client, actions)
actions.clear()
@@ -110,4 +110,4 @@ def sync(city=None):
log.info(f"完成同步商圈至206 {index_name}")
sync()
sync('上海')