Commit 96764c9b authored by 段英荣's avatar 段英荣

modify

parent f8010faf
...@@ -19,9 +19,10 @@ class ESPerform(object): ...@@ -19,9 +19,10 @@ class ESPerform(object):
@classmethod @classmethod
def get_cli(cls): def get_cli(cls,es_ip_list=None):
try: try:
cls.cli_obj = Elasticsearch(cls.cli_info_list) es_info_list = es_ip_list if es_ip_list else cls.cli_info_list
cls.cli_obj = Elasticsearch(es_info_list)
return cls.cli_obj return cls.cli_obj
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......
...@@ -25,6 +25,9 @@ class DoctorTransfer(object): ...@@ -25,6 +25,9 @@ class DoctorTransfer(object):
# 命中开始部分加权 # 命中开始部分加权
begin_prefix_weight = 1.2 begin_prefix_weight = 1.2
test_es_info_list = [
{'host': '10.30.57.94', 'port': 9200}
]
@classmethod @classmethod
def get_doctor_data_name_mapping_results_to_redis(cls, instance): def get_doctor_data_name_mapping_results_to_redis(cls, instance):
try: try:
...@@ -60,7 +63,8 @@ class DoctorTransfer(object): ...@@ -60,7 +63,8 @@ class DoctorTransfer(object):
} }
} }
} }
result_dict = ESPerform.get_search_results(ESPerform.get_cli(), sub_index_name="doctor", query_body=q)
result_dict = ESPerform.get_search_results(cls.test_es_info_list, sub_index_name="doctor", query_body=q)
doctor_results = result_dict["total_count"] doctor_results = result_dict["total_count"]
redis_key_prefix = "search_tips:tips_mapping_num" redis_key_prefix = "search_tips:tips_mapping_num"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment