Commit 641553bb authored by lixiaofang's avatar lixiaofang

add

parent 2131d6ec
...@@ -76,8 +76,10 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50): ...@@ -76,8 +76,10 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
#### ####
if len(ret_list) >= 50: if len(ret_list) >= 50:
return ret_list[0:50] return ret_list[0:50]
elif len(ret_list) < 50 and len(ret_list) > 0:
elif len(ret_list) < 50 and len(ret_list) > 5:
return ret_list return ret_list
else: else:
##无结果的时候把汉字转成拼音再搜一次 ##无结果的时候把汉字转成拼音再搜一次
ss = lazy_pinyin(query) ss = lazy_pinyin(query)
...@@ -85,9 +87,11 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50): ...@@ -85,9 +87,11 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
for item in ss: for item in ss:
str_query += str(item) str_query += str(item)
have_read_tips_set, ret_list, result_dict = get_query_by_es(query=str_query, lat=lat, lng=lng, have_read_tips_set, pinyin_ret_list, result_dict = get_query_by_es(query=str_query, lat=lat, lng=lng,
offset=offset, offset=offset,
size=size, highlight_query=query) size=size - len(ret_list),
highlight_query=query)
ret_list.extend(pinyin_ret_list)
logging.info("get ret_list:%s" % ret_list) logging.info("get ret_list:%s" % ret_list)
return ret_list return ret_list
......
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