Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
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
alpha
physical
Commits
6c96b6f8
Commit
6c96b6f8
authored
Aug 31, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify search
parent
4d9341b6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
topic.py
search/utils/topic.py
+0
-0
trans2es_data2es_parallel.py
trans2es/management/commands/trans2es_data2es_parallel.py
+24
-0
No files found.
search/utils/topic.py
View file @
6c96b6f8
This diff is collapsed.
Click to expand it.
trans2es/management/commands/trans2es_data2es_parallel.py
View file @
6c96b6f8
...
...
@@ -29,6 +29,12 @@ from search.utils.common import *
from
linucb.views.collect_data
import
CollectData
from
injection.data_sync.tasks
import
sync_user_similar_score
from
trans2es.models.tag
import
Tag
from
libs.cache
import
redis_client
from
trans2es.models.tag
import
TopicTag
class
Job
(
object
):
__es
=
None
...
...
@@ -189,6 +195,20 @@ class Command(BaseCommand):
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
def
sync_tag_collecction_name_set
(
self
):
try
:
collection_redis_key_name
=
"physical:official_tag_name_set"
tag_list
=
TopicTag
.
objects
.
filter
(
is_online
=
True
,
is_collection
=
True
)
.
values_list
(
"tag_id"
,
flat
=
True
)
for
tag_id
in
tag_list
:
tag_name
=
Tag
.
objects
.
filter
(
id
=
tag_id
,
is_online
=
True
,
is_deleted
=
False
,
is_category
=
False
)
.
values_list
(
"name"
,
flat
=
True
)
if
tag_name
and
len
(
tag_name
)
>
0
and
tag_name
[
0
]:
redis_client
.
sadd
(
collection_redis_key_name
,
tag_name
[
0
])
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
def
handle
(
self
,
*
args
,
**
options
):
try
:
type_name_list
=
get_type_info_map
()
.
keys
()
...
...
@@ -211,5 +231,9 @@ class Command(BaseCommand):
if
len
(
options
[
"sync_type"
])
and
options
[
"sync_type"
]
==
"similar"
:
sync_user_similar_score
()
if
len
(
options
[
"sync_type"
])
and
options
[
"sync_type"
]
==
"tagname"
:
self
.
sync_tag_collecction_name_set
()
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
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