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
fe6f5350
Commit
fe6f5350
authored
Mar 18, 2020
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据同步
parent
1a9325c1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
5 deletions
+23
-5
tasks.py
injection/data_sync/tasks.py
+4
-1
type_info.py
trans2es/type_info.py
+1
-0
doctor_transfer.py
trans2es/utils/doctor_transfer.py
+2
-1
hospital_transfer.py
trans2es/utils/hospital_transfer.py
+16
-3
No files found.
injection/data_sync/tasks.py
View file @
fe6f5350
...
...
@@ -13,7 +13,10 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
try
:
suggest_index_type
=
[
"doctor_tips"
,
"hospital_tips"
,
"itemwiki_tips"
,
"collectwiki_tips"
,
'brandwiki_tips'
,
"productwiki_tips"
,
'tag_tips'
,
'wordrel_tips'
]
'brandwiki_tips'
,
"productwiki_tips"
,
'tag_tips'
,
'wordrel_tips'
,
'search_query'
,
'search_query-v1'
,
"doctor_tips-v1"
,
"hospital_tips-v1"
,
"itemwiki_tips-v1"
,
"collectwiki_tips-v1"
,
'brandwiki_tips-v1'
,
"productwiki_tips-v1"
,
'tag_tips-v1'
,
'wordrel_tips-v1'
]
if
es_type
in
suggest_index_type
:
pk_list
=
list
(
frozenset
(
pk_list
))
type_info_map
=
get_type_info_map
()
...
...
trans2es/type_info.py
View file @
fe6f5350
...
...
@@ -228,6 +228,7 @@ class TypeInfo(object):
else
:
instance_list
=
qs
.
filter
(
pk__in
=
pk_list
)
logging
.
info
(
"get instance_list:
%
s"
%
instance_list
)
data_list
=
self
.
bulk_get_data
(
instance_list
)
self
.
elasticsearch_bulk_insert_data
(
sub_index_name
=
sub_index_name
,
...
...
trans2es/utils/doctor_transfer.py
View file @
fe6f5350
...
...
@@ -9,7 +9,6 @@ from libs.es import ESPerform
from
libs.cache
import
redis_client
import
json
from
django.conf
import
settings
from
trans2es.commons.commons
import
get_tips_suggest_list
,
get_tips_suggest_list_v1
from
trans2es.commons.words_utils
import
QueryWordAttr
,
get_tips_word_type
...
...
@@ -202,3 +201,5 @@ class DoctorTransferV1(object):
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
(
dict
(),
list
())
trans2es/utils/hospital_transfer.py
View file @
fe6f5350
...
...
@@ -8,7 +8,7 @@ from libs.tools import tzlc, getMd5Digest
from
libs.es
import
ESPerform
from
libs.cache
import
redis_client
import
json
from
trans2es.models.doctor
import
Doctor
from
trans2es.commons.commons
import
get_tips_suggest_list
,
get_tips_suggest_list_v1
from
trans2es.commons.words_utils
import
QueryWordAttr
,
get_tips_word_type
...
...
@@ -35,7 +35,8 @@ class HospitalTransfer(object):
item_dict
=
dict
()
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
name
))
item_dict
[
"ori_name"
]
=
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"is_online"
]
=
by_hospital_id_judge_office_online
(
is_online
=
instance
.
is_online
,
hospital_id
=
instance
.
id
)
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_hospital_query_word_weight
(
name
)
item_dict
[
"results_num"
]
=
QueryWordAttr
.
get_query_results_num
(
name
)
...
...
@@ -86,7 +87,8 @@ class HospitalTransferV1(object):
item_dict
=
dict
()
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
name
))
item_dict
[
"ori_name"
]
=
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"is_online"
]
=
by_hospital_id_judge_office_online
(
is_online
=
instance
.
is_online
,
hospital_id
=
instance
.
id
)
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_hospital_query_word_weight
(
name
)
item_dict
[
"results_num"
]
=
QueryWordAttr
.
get_query_results_num
(
name
)
...
...
@@ -115,3 +117,14 @@ class HospitalTransferV1(object):
redis_client
.
hset
(
redis_key_prefix
,
name
,
pos_list
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
def
by_hospital_id_judge_office_online
(
is_online
=
False
,
hospital_id
=
None
):
try
:
office
=
Doctor
.
objects
.
filter
(
hospital_id
=
hospital_id
,
is_online
=
True
,
doctor_type
=
1
)
if
office
and
is_online
:
return
True
return
False
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
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