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
d84f4fda
Commit
d84f4fda
authored
Jul 09, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
7954c4ed
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
tasks.py
injection/data_sync/tasks.py
+2
-1
type_info.py
trans2es/type_info.py
+9
-1
No files found.
injection/data_sync/tasks.py
View file @
d84f4fda
...
@@ -23,7 +23,8 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
...
@@ -23,7 +23,8 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
sub_index_name
=
type_info
.
name
,
sub_index_name
=
type_info
.
name
,
pk_list
=
pk_list
,
pk_list
=
pk_list
,
use_batch_query_set
=
use_batch_query_set
,
use_batch_query_set
=
use_batch_query_set
,
es
=
ESPerform
.
get_cli
()
es
=
ESPerform
.
get_cli
(),
es_type
=
es_type
)
)
else
:
else
:
pk_list
=
list
(
frozenset
(
pk_list
))
pk_list
=
list
(
frozenset
(
pk_list
))
...
...
trans2es/type_info.py
View file @
d84f4fda
...
@@ -210,13 +210,21 @@ class TypeInfo(object):
...
@@ -210,13 +210,21 @@ class TypeInfo(object):
es
=
es
,
es
=
es
,
)
)
def
insert_table_by_pk_list
(
self
,
sub_index_name
,
pk_list
,
es
=
None
,
use_batch_query_set
=
False
):
def
insert_table_by_pk_list
(
self
,
sub_index_name
,
pk_list
,
es
=
None
,
use_batch_query_set
=
False
,
es_type
=
None
):
if
use_batch_query_set
:
if
use_batch_query_set
:
qs
=
self
.
queryset
qs
=
self
.
queryset
else
:
else
:
qs
=
self
.
model
.
objects
.
all
()
qs
=
self
.
model
.
objects
.
all
()
if
es_type
==
"doctor_tips"
:
instance_list
=
qs
.
filter
(
pk__in
=
pk_list
,
doctor_type
=
DOCTOR_TYPE
.
DOCTOR
)
elif
es_type
==
"wordrel_tips"
:
instance_list
=
qs
.
filter
(
pk__in
=
pk_list
,
category__in
=
[
13
,
12
,
11
,
9
,
1
])
elif
es_type
==
"tag_tips"
:
instance_list
=
qs
.
filter
(
pk__in
=
pk_list
,
tag_type__in
=
[
TAG_TYPE
.
BODY_PART
,
TAG_TYPE
.
BODY_PART_SUB_ITEM
,
TAG_TYPE
.
ITEM_WIKI
])
else
:
instance_list
=
qs
.
filter
(
pk__in
=
pk_list
)
instance_list
=
qs
.
filter
(
pk__in
=
pk_list
)
data_list
=
self
.
bulk_get_data
(
instance_list
)
data_list
=
self
.
bulk_get_data
(
instance_list
)
self
.
elasticsearch_bulk_insert_data
(
self
.
elasticsearch_bulk_insert_data
(
sub_index_name
=
sub_index_name
,
sub_index_name
=
sub_index_name
,
...
...
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