Commit a04caf2e authored by lixiaofang's avatar lixiaofang

修改结果

parent c11344ba
import sys
from gm_rpcd.commands.utils import add_cwd_to_path
from gm_rpcd.internals.utils import serve
def main(args):
add_cwd_to_path()
from gm_rpcd.internals.configuration import config
config.is_develop_mode = True
config.freeze()
host = '127.0.0.1'
port = 9000
try:
first_arg = args[0]
except IndexError:
pass
else:
if ':' in first_arg:
host, port = first_arg.split(':')
port = int(port)
else:
port = int(first_arg)
print('Serving on {}:{}'.format(host, port))
serve(host=host, port=port)
if __name__ == '__main__':
main(sys.argv[1:])
...@@ -96,10 +96,12 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50): ...@@ -96,10 +96,12 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
ori_name = base64.b64decode(ori.encode('utf8')).decode('utf8') ori_name = base64.b64decode(ori.encode('utf8')).decode('utf8')
if ori_name not in have_read_tips_set: if ori_name not in have_read_tips_set:
result_num = i.split(":")[1] result_num = i.split(":")[1]
highlight_marks = u'<ems>%s</ems>' % query
highlight_name = hit_item["_source"]["ori_name"].replace(query, highlight_marks)
ret_list.append( ret_list.append(
{"results_num": result_num, "ori_name": ori_name, "id": None, "is_online": True, {"results_num": result_num, "ori_name": ori_name, "id": None, "is_online": True,
"offline_score": 0, "offline_score": 0,
"type_flag": get_tips_word_type(ori_name), "highlight_name": ori_name, "describe": ""}) "type_flag": get_tips_word_type(ori_name), "highlight_name": highlight_name, "describe": ""})
if len(ret_list) >= 50: if len(ret_list) >= 50:
return ret_list[0:50] return ret_list[0:50]
......
...@@ -530,9 +530,9 @@ def tips_attr_sync_to_redis_type_info_map(): ...@@ -530,9 +530,9 @@ def tips_attr_sync_to_redis_type_info_map():
TypeInfo( TypeInfo(
name='suggest', name='suggest',
type='wordrel_results_num', # api_wordrelresemble type='wordrel_results_num', # api_wordrelresemble
model=doctor.Hospital, model=wordresemble.WordRel,
query_deferred=lambda: wordresemble.WordRel.objects.filter( query_deferred=lambda: wordresemble.WordRel.objects.filter(
category__in=[0, 1, 2, 9, 10, 11, 12, 13, 14, 15, 16, 17]).query, category__in=[13, 12, 11, 9, 1]).query,
get_data_func=WordResemble.get_all_data_name_mapping_results_to_redis, get_data_func=WordResemble.get_all_data_name_mapping_results_to_redis,
bulk_insert_chunk_size=100, bulk_insert_chunk_size=100,
round_insert_chunk_size=5, round_insert_chunk_size=5,
...@@ -541,9 +541,9 @@ def tips_attr_sync_to_redis_type_info_map(): ...@@ -541,9 +541,9 @@ def tips_attr_sync_to_redis_type_info_map():
TypeInfo( TypeInfo(
name='suggest', name='suggest',
type='wordresemble_results_num', # api_wordrelresemble type='wordresemble_results_num', # api_wordrelresemble
model=doctor.Hospital, model=wordresemble.WordRel,
query_deferred=lambda: wordresemble.WordRel.objects.filter( query_deferred=lambda: wordresemble.WordRel.objects.filter(
category__in=[0, 1, 2, 9, 10, 11, 12, 13, 14, 15, 16, 17]).query, category__in=[13, 12, 11, 9, 1]).query,
get_data_func=WordResemble.set_data_to_redis, get_data_func=WordResemble.set_data_to_redis,
bulk_insert_chunk_size=100, bulk_insert_chunk_size=100,
round_insert_chunk_size=5, round_insert_chunk_size=5,
......
...@@ -152,7 +152,7 @@ class WordResemble(object): ...@@ -152,7 +152,7 @@ class WordResemble(object):
@classmethod @classmethod
def set_data_to_redis(cls, instance): def set_data_to_redis(cls, instance):
try: try:
WordResemble.get_all_data_name_mapping_results_to_redis(instance)
QUERY_KEY = "query:{}:search_tip" QUERY_KEY = "query:{}:search_tip"
tips_num_redis_key_prefix = "search_tips:tips_mapping_num" tips_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