Commit 597ee7a2 authored by lixiaofang's avatar lixiaofang

add

parent 367c9627
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:])
......@@ -172,8 +172,10 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
value_data = []
QUERY_KEY = "query:search_tip"
query_base64 = base64.b64encode(query.encode('utf8')).decode('utf8')
logging.info("get query_base64:%s" % query_base64)
if redis_client.hget(QUERY_KEY, query_base64) is not None:
value_data = json.loads(redis_client.hget(QUERY_KEY, query_base64))
logging.info("get value_data:%s" % value_data)
if len(value_data) > 0:
for i in value_data:
......@@ -200,7 +202,6 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
ret_list.extend(wordresemble_ret_list)
if len(ret_list) >= 50:
return ret_list[0:50]
else:
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