最近商圈
This commit is contained in:
@@ -69,9 +69,10 @@ def deal(actions, item):
|
|||||||
doc_info = dict()
|
doc_info = dict()
|
||||||
# 商圈
|
# 商圈
|
||||||
business_district_doc = find_nearest_by_location(curr_city, 10000, [lng, lat])
|
business_district_doc = find_nearest_by_location(curr_city, 10000, [lng, lat])
|
||||||
if pd.notna(business_district_doc):
|
if pd.isna(business_district_doc):
|
||||||
doc_info['nearest_business_district_distance'] = int(business_district_doc['sort'][0])
|
return
|
||||||
doc_info['nearest_business_district'] = business_district_doc['_source']['name']
|
doc_info['nearest_business_district_distance'] = int(business_district_doc['sort'][0])
|
||||||
|
doc_info['nearest_business_district'] = business_district_doc['_source']['name']
|
||||||
|
|
||||||
action = {
|
action = {
|
||||||
"_op_type": "update",
|
"_op_type": "update",
|
||||||
@@ -102,7 +103,6 @@ def sync(city=None):
|
|||||||
with ThreadPoolExecutor(max_workers=30) as pool:
|
with ThreadPoolExecutor(max_workers=30) as pool:
|
||||||
for index, item in seaweed_df.iterrows():
|
for index, item in seaweed_df.iterrows():
|
||||||
pool.submit(deal, actions, item)
|
pool.submit(deal, actions, item)
|
||||||
|
|
||||||
if len(actions) > 0:
|
if len(actions) > 0:
|
||||||
helpers.bulk(es206_client.elastic_client, actions)
|
helpers.bulk(es206_client.elastic_client, actions)
|
||||||
actions.clear()
|
actions.clear()
|
||||||
@@ -110,4 +110,4 @@ def sync(city=None):
|
|||||||
log.info(f"完成同步商圈至206 {index_name}")
|
log.info(f"完成同步商圈至206 {index_name}")
|
||||||
|
|
||||||
|
|
||||||
sync()
|
sync('上海')
|
||||||
Reference in New Issue
Block a user