Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
search_tips
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rank
search_tips
Commits
9b708f86
Commit
9b708f86
authored
Jun 10, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mapping
parent
fd94d0d2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
58 deletions
+79
-58
es.py
libs/es.py
+0
-1
auto_tips.py
search/utils/auto_tips.py
+0
-2
settings_local.py
search_tips/settings_local.py
+36
-36
suggest.json
trans2es/mapping/suggest.json
+43
-16
type_info.py
trans2es/type_info.py
+0
-3
No files found.
libs/es.py
View file @
9b708f86
...
...
@@ -108,7 +108,6 @@ class ESPerform(object):
index_exist
=
es_cli
.
indices
.
exists
(
write_alias_name
)
if
not
index_exist
:
return
False
mapping_dict
=
cls
.
__load_mapping
(
sub_index_name
)
es_cli
.
indices
.
put_mapping
(
index
=
write_alias_name
,
body
=
mapping_dict
,
doc_type
=
mapping_type
)
...
...
search/utils/auto_tips.py
View file @
9b708f86
...
...
@@ -54,9 +54,7 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
highlight_marks
=
u'<ems>
%
s</ems>'
%
query
hit_item
[
"_source"
][
"highlight_name"
]
=
hit_item
[
"_source"
][
"ori_name"
]
.
replace
(
query
,
highlight_marks
)
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
hit_item
[
"_source"
][
"ori_name"
]
in
g_hospital_pos_dict
:
distance
=
point_distance
(
lng
,
lat
,
...
...
search_tips/settings_local.py
View file @
9b708f86
...
...
@@ -14,42 +14,42 @@ REDIS_URL = "redis://redis.paas.env:6379/13"
CELERY_BROKER_URL
=
"redis://127.0.0.1:6379/8"
DATABASES
=
{
'default'
:
{
# 'ENGINE': 'django.db.backends.mysql',
# 'NAME': 'zhengxing_test',
# 'USER': 'work',
# 'PASSWORD': 'workwork',
# 'HOST': 'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com',
# 'PORT': '',
# 'OPTIONS': {
# "init_command": "SET foreign_key_checks = 0;",
# "charset": "utf8mb4",
# }
'ENGINE'
:
'django.db.backends.mysql'
,
# 设置为mysql数据库
'NAME'
:
'zhengxing_test'
,
'USER'
:
'work'
,
'PASSWORD'
:
'Gengmei1'
,
'HOST'
:
'rm-2ze0v6uua2hl9he8edo.mysql.rds.aliyuncs.com'
,
'PORT'
:
'3306'
,
'OPTIONS'
:
{
"init_command"
:
"SET foreign_key_checks = 0;"
,
"charset"
:
"utf8mb4"
,
# 为了支持emoji表情
},
},
'bran'
:
{
'ENGINE'
:
'django.db.backends.mysql'
,
# 设置为mysql数据库
'NAME'
:
'bran_test'
,
'USER'
:
'work'
,
'PASSWORD'
:
'workwork'
,
'HOST'
:
'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com'
,
'PORT'
:
'3306'
,
'OPTIONS'
:
{
"init_command"
:
"SET foreign_key_checks = 0;"
,
"charset"
:
"utf8mb4"
,
# 为了支持emoji表情
},
}
}
#
DATABASES = {
#
'default': {
#
# 'ENGINE': 'django.db.backends.mysql',
#
# 'NAME': 'zhengxing_test',
#
# 'USER': 'work',
#
# 'PASSWORD': 'workwork',
#
# 'HOST': 'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com',
#
# 'PORT': '',
#
# 'OPTIONS': {
#
# "init_command": "SET foreign_key_checks = 0;",
#
# "charset": "utf8mb4",
#
# }
# #
'ENGINE': 'django.db.backends.mysql', # 设置为mysql数据库
# #
'NAME': 'zhengxing_test',
# #
'USER': 'work',
# #
'PASSWORD': 'Gengmei1',
# #
'HOST': 'rm-2ze0v6uua2hl9he8edo.mysql.rds.aliyuncs.com',
# #
'PORT': '3306',
# #
'OPTIONS': {
# #
"init_command": "SET foreign_key_checks = 0;",
# #
"charset": "utf8mb4", # 为了支持emoji表情
#
},
#
},
#
'bran': {
#
'ENGINE': 'django.db.backends.mysql', # 设置为mysql数据库
#
'NAME': 'bran_test',
#
'USER': 'work',
#
'PASSWORD': 'workwork',
#
'HOST': 'rdsmaqevmuzj6jy.mysql.rds.aliyuncs.com',
#
'PORT': '3306',
#
'OPTIONS': {
#
"init_command": "SET foreign_key_checks = 0;",
#
"charset": "utf8mb4", # 为了支持emoji表情
#
},
#
}
#
}
# ES_INFO_LIST = [
# {
...
...
trans2es/mapping/suggest.json
View file @
9b708f86
{
"dynamic"
:
"strict"
,
"dynamic"
:
"strict"
,
"properties"
:
{
"id"
:{
"type"
:
"text"
},
"suggest"
:{
"analyzer"
:
"keyword"
,
"search_analyzer"
:
"keyword"
,
"type"
:
"completion"
,
"contexts"
:[
"id"
:
{
"type"
:
"text"
},
"suggest"
:
{
"type"
:
"completion"
,
"analyzer"
:
"keyword"
,
"search_analyzer"
:
"keyword"
,
"skip_duplicates"
:
"true"
,
"contexts"
:
[
{
"name"
:
"is_online"
,
"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"
}
//上线
"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"
}
//上线
}
}
\ No newline at end of file
trans2es/type_info.py
View file @
9b708f86
...
...
@@ -137,9 +137,6 @@ class TypeInfo(object):
continue
data
=
self
.
get_data_func
(
instance
)
(
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
:
instance
.
name
=
instance
.
keyword
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment