Commit 7a6e1e35 authored by lixiaofang's avatar lixiaofang

完全匹配放前边

parent 888092c4
......@@ -114,6 +114,8 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
get_tag_wiki_data = list()
have_read_tips_set = set()
ret_list = list()
doctor_hospital_equal_query = list()
tag_equal_query = list()
result_dict = ESPerform.get_search_results(ESPerform.get_cli(), sub_index_name="suggest", query_body=q,
offset=offset, size=size, is_suggest_request=True)
......@@ -148,17 +150,29 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
else:
hit_item["_source"]["describe"] = ""
get_doctor_hospital_data.append(hit_item["_source"])
if hit_item["_source"]["ori_name"] == query:
doctor_hospital_equal_query.append(hit_item["_source"])
else:
get_doctor_hospital_data.append(hit_item["_source"])
else:
if hit_item["_source"]["type_flag"] == "doctor":
hit_item["_source"]["describe"] = ""
get_doctor_hospital_data.append(hit_item["_source"])
if hit_item["_source"]["ori_name"] == query:
doctor_hospital_equal_query.append(hit_item["_source"])
else:
get_doctor_hospital_data.append(hit_item["_source"])
else:
hit_item["_source"]["describe"] = "约" + str(hit_item["_source"]["results_num"]) + "个结果" if \
hit_item["_source"]["results_num"] else ""
get_tag_wiki_data.append(hit_item["_source"])
if hit_item["_source"]["ori_name"] == query:
tag_equal_query.append(hit_item["_source"])
else:
get_tag_wiki_data.append(hit_item["_source"])
ret_list.extend(tag_equal_query)
ret_list.extend(doctor_hospital_equal_query)
ret_list.extend(get_tag_wiki_data)
ret_list.extend(get_doctor_hospital_data)
......
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