Commit 09c3309d authored by lixiaofang's avatar lixiaofang

dad

parent 4eecfd3d
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:])
......@@ -34,10 +34,14 @@ class Command(BaseCommand):
try:
es_cli = ESPerform.get_cli()
type_name1 = "suggest-v1"
type_name = "suggest"
if len(options["type"]):
if options["type"] == "all" or type_name == options["type"]:
if options["type"] == "all" or type_name == options["type"] or type_name1 == options["type"]:
type_name = options["type"]
official_index_name = ESPerform.get_official_index_name(type_name)
index_exists = es_cli.indices.exists(official_index_name)
if not index_exists:
......
{
"dynamic":"strict",
"properties": {
"id":{"type":"text"},
"suggest":{
"analyzer":"keyword",
"search_analyzer":"keyword",
"type":"completion",
"contexts":[
{
"name":"is_online",
"type": "category"
}
]
},
"suggest_type":{"type":"long"},//0-汉字,1-汉字全拼,2-拼音,3-拼音全拼,4-拼音简写,5-拼音简写全拼
"tips_name_type":{"type":"long"},//tips数据所属类型,0-tag,1-hospital,2-doctor,3-wiki
"ori_name":{"type":"keyword"},//原名称
"order_weight":{"type":"double"},//订单权重
"offline_score":{"type":"double"},//离线分
"results_num":{"type":"integer"},//结果数量
"type_flag":{"type":"keyword"},
"is_online":{"type":"boolean"}//上线
}
}
......@@ -347,7 +347,8 @@ def get_type_info_map():
name='suggest',
type='wordrel_tips', # tag
model=wordresemble.WordRel,
query_deferred=lambda: wordresemble.WordRel.objects.all().query,
query_deferred=lambda: wordresemble.WordRel.objects.filter(
category__in=[0, 1, 2, 9, 10, 11, 12, 13, 14, 15, 16, 17]).query,
get_data_func=WordResemble.get_resemble_list,
bulk_insert_chunk_size=100,
round_insert_chunk_size=5,
......@@ -445,7 +446,8 @@ def tips_attr_sync_to_redis_type_info_map():
name='suggest',
type='wordrel_results_num', # api_wordrelresemble
model=doctor.Hospital,
query_deferred=lambda: wordresemble.WordRel.objects.all().query,
query_deferred=lambda: wordresemble.WordRel.objects.filter(
category__in=[0, 1, 2, 9, 10, 11, 12, 13, 14, 15, 16, 17]).query,
get_data_func=WordResemble.get_all_data_name_mapping_results_to_redis,
bulk_insert_chunk_size=100,
round_insert_chunk_size=5,
......@@ -455,7 +457,8 @@ def tips_attr_sync_to_redis_type_info_map():
name='suggest',
type='wordresemble_results_num', # api_wordrelresemble
model=doctor.Hospital,
query_deferred=lambda: wordresemble.WordRel.objects.all().query,
query_deferred=lambda: wordresemble.WordRel.objects.filter(
category__in=[0, 1, 2, 9, 10, 11, 12, 13, 14, 15, 16, 17]).query,
get_data_func=WordResemble.set_data_to_redis,
bulk_insert_chunk_size=100,
round_insert_chunk_size=5,
......
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