Commit b79f2e6f authored by lixiaofang's avatar lixiaofang

高亮

parent 2f6c7c4c
......@@ -172,7 +172,7 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
QUERY_KEY = "query:search_tip"
query_base64 = base64.b64encode(query.encode('utf8')).decode('utf8')
if redis_client.hget(QUERY_KEY, query_base64) is not None:
value_data = json.loads(str(redis_client.hget(QUERY_KEY, query_base64),encoding='utf-8'))
value_data = json.loads(str(redis_client.hget(QUERY_KEY, query_base64), encoding='utf-8'))
if len(value_data) > 0:
for i in value_data:
......@@ -192,13 +192,43 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
"type_flag": get_tips_word_type(ori_name), "highlight_name": highlight_name,
"describe": describe})
else:
wordresemble_ret_list.append(
{"results_num": result_num, "ori_name": ori_name, "id": None, "is_online": True,
"offline_score": 0,
"type_flag": get_tips_word_type(ori_name), "highlight_name": highlight_name,
"describe": describe})
ret_list.extend(query_ret_list)
ret_list.extend(wordresemble_ret_list)
###高亮调整
query_ret_list.extend(wordresemble_ret_list)
high_query = None
for ret in query_ret_list:
query2 = ret["ori_name"]
for item in range(0, len(query)):
is_find = query2.find(query[item])
if is_find >= 0:
highlight_marks = u'<ems>%s</ems>' % query[item]
high_query = query2.replace(query[item], highlight_marks)
query2 = high_query
ret["highlight_name"] = high_query
###繁体字删掉,把搜索结果加到简体字上边
fanti_query = [{'痩脸针': "瘦脸针"}]
for item in ret_list:
result_num = [[item['results_num'], list(ret.values())[0], list(ret.keys())[0]] for ret in fanti_query
if
list(ret.keys())[0] == item['ori_name']]
if len(result_num) > 0:
ret_list.remove(item)
for item in ret_list:
if item['ori_name'] == result_num[0][1]:
item['results_num'] += result_num[0][0]
####
if len(ret_list) >= 50:
return ret_list[0:50]
else:
......
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