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
09c3309d
Commit
09c3309d
authored
Jun 12, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dad
parent
4eecfd3d
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
4 deletions
+67
-4
develop_server.py
develop_server.py
+31
-0
trans2es_mapping2es.py
trans2es/management/commands/trans2es_mapping2es.py
+5
-1
suggest-v1.json
trans2es/mapping/suggest-v1.json
+25
-0
type_info.py
trans2es/type_info.py
+6
-3
No files found.
develop_server.py
0 → 100644
View file @
09c3309d
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
:])
trans2es/management/commands/trans2es_mapping2es.py
View file @
09c3309d
...
...
@@ -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
:
...
...
trans2es/mapping/suggest-v1.json
0 → 100644
View file @
09c3309d
{
"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"
}
//上线
}
}
trans2es/type_info.py
View file @
09c3309d
...
...
@@ -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
,
...
...
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