Commit 9b708f86 authored by lixiaofang's avatar lixiaofang

mapping

parent fd94d0d2
...@@ -108,7 +108,6 @@ class ESPerform(object): ...@@ -108,7 +108,6 @@ class ESPerform(object):
index_exist = es_cli.indices.exists(write_alias_name) index_exist = es_cli.indices.exists(write_alias_name)
if not index_exist: if not index_exist:
return False return False
mapping_dict = cls.__load_mapping(sub_index_name) mapping_dict = cls.__load_mapping(sub_index_name)
es_cli.indices.put_mapping(index=write_alias_name, body=mapping_dict, doc_type=mapping_type) es_cli.indices.put_mapping(index=write_alias_name, body=mapping_dict, doc_type=mapping_type)
......
...@@ -54,9 +54,7 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50): ...@@ -54,9 +54,7 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
highlight_marks = u'<ems>%s</ems>' % query highlight_marks = u'<ems>%s</ems>' % query
hit_item["_source"]["highlight_name"] = hit_item["_source"]["ori_name"].replace(query, hit_item["_source"]["highlight_name"] = hit_item["_source"]["ori_name"].replace(query,
highlight_marks) highlight_marks)
if hit_item["_source"]["type_flag"] == "hospital": if hit_item["_source"]["type_flag"] == "hospital":
if lat is not None and lng is not None and lat != 0.0 and lng != 0.0: if lat is not None and lng is not None and lat != 0.0 and lng != 0.0:
if hit_item["_source"]["ori_name"] in g_hospital_pos_dict: if hit_item["_source"]["ori_name"] in g_hospital_pos_dict:
distance = point_distance(lng, lat, distance = point_distance(lng, lat,
......
...@@ -14,42 +14,42 @@ REDIS_URL = "redis://redis.paas.env:6379/13" ...@@ -14,42 +14,42 @@ REDIS_URL = "redis://redis.paas.env:6379/13"
CELERY_BROKER_URL = "redis://127.0.0.1:6379/8" CELERY_BROKER_URL = "redis://127.0.0.1:6379/8"
DATABASES = { # DATABASES = {
'default': { # 'default': {
# 'ENGINE': 'django.db.backends.mysql', # # 'ENGINE': 'django.db.backends.mysql',
# 'NAME': 'zhengxing_test', # # 'NAME': 'zhengxing_test',
# 'USER': 'work', # # 'USER': 'work',
# 'PASSWORD': 'workwork', # # 'PASSWORD': 'workwork',
# 'HOST': 'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com', # # 'HOST': 'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com',
# 'PORT': '', # # 'PORT': '',
# 'OPTIONS': { # # 'OPTIONS': {
# "init_command": "SET foreign_key_checks = 0;", # # "init_command": "SET foreign_key_checks = 0;",
# "charset": "utf8mb4", # # "charset": "utf8mb4",
# } # # }
'ENGINE': 'django.db.backends.mysql', # 设置为mysql数据库 # # 'ENGINE': 'django.db.backends.mysql', # 设置为mysql数据库
'NAME': 'zhengxing_test', # # 'NAME': 'zhengxing_test',
'USER': 'work', # # 'USER': 'work',
'PASSWORD': 'Gengmei1', # # 'PASSWORD': 'Gengmei1',
'HOST': 'rm-2ze0v6uua2hl9he8edo.mysql.rds.aliyuncs.com', # # 'HOST': 'rm-2ze0v6uua2hl9he8edo.mysql.rds.aliyuncs.com',
'PORT': '3306', # # 'PORT': '3306',
'OPTIONS': { # # 'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;", # # "init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4", # 为了支持emoji表情 # # "charset": "utf8mb4", # 为了支持emoji表情
}, # },
}, # },
'bran': { # 'bran': {
'ENGINE': 'django.db.backends.mysql', # 设置为mysql数据库 # 'ENGINE': 'django.db.backends.mysql', # 设置为mysql数据库
'NAME': 'bran_test', # 'NAME': 'bran_test',
'USER': 'work', # 'USER': 'work',
'PASSWORD': 'workwork', # 'PASSWORD': 'workwork',
'HOST': 'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com', # 'HOST': 'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com',
'PORT': '3306', # 'PORT': '3306',
'OPTIONS': { # 'OPTIONS': {
"init_command": "SET foreign_key_checks = 0;", # "init_command": "SET foreign_key_checks = 0;",
"charset": "utf8mb4", # 为了支持emoji表情 # "charset": "utf8mb4", # 为了支持emoji表情
}, # },
} # }
} # }
# ES_INFO_LIST = [ # ES_INFO_LIST = [
# { # {
......
{ {
"dynamic":"strict", "dynamic": "strict",
"properties": { "properties": {
"id":{"type":"text"}, "id": {
"suggest":{ "type": "text"
"analyzer":"keyword", },
"search_analyzer":"keyword", "suggest": {
"type":"completion", "type": "completion",
"contexts":[ "analyzer": "keyword",
"search_analyzer": "keyword",
"skip_duplicates":"true",
"contexts": [
{ {
"name":"is_online", "name": "is_online",
"type": "category" "type": "category"
} }
] ]
}, },
"suggest_type":{"type":"long"},//0-汉字,1-汉字全拼,2-拼音,3-拼音全拼,4-拼音简写,5-拼音简写全拼 "suggest_type": {
"tips_name_type":{"type":"long"},//tips数据所属类型,0-tag,1-hospital,2-doctor,3-wiki "type": "long"
"ori_name":{"type":"keyword"},//原名称 },
"order_weight":{"type":"double"},//订单权重 //0-汉字,1-汉字全拼,2-拼音,3-拼音全拼,4-拼音简写,5-拼音简写全拼
"offline_score":{"type":"double"},//离线分 "tips_name_type": {
"results_num":{"type":"integer"},//结果数量 "type": "long"
"type_flag":{"type":"keyword"}, },
"is_online":{"type":"boolean"}//上线 //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"
}
//上线
} }
} }
\ No newline at end of file
...@@ -137,9 +137,6 @@ class TypeInfo(object): ...@@ -137,9 +137,6 @@ class TypeInfo(object):
continue continue
data = self.get_data_func(instance) data = self.get_data_func(instance)
(item_dict, suggest_list) = data (item_dict, suggest_list) = data
logging.info("get-------------item_dict:%s" % item_dict['tips_name_type'])
logging.info("get-------------item_dict:%s" % suggest_list)
if item_dict["tips_name_type"] == 4: if item_dict["tips_name_type"] == 4:
instance.name = instance.keyword instance.name = instance.keyword
......
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