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
b3c627a6
Commit
b3c627a6
authored
Apr 09, 2019
by
EDZ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
judge topic star
parent
cad53f5b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
topic.py
search/views/topic.py
+4
-3
type_info.py
trans2es/type_info.py
+21
-4
No files found.
search/views/topic.py
View file @
b3c627a6
...
...
@@ -136,8 +136,9 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# else:
# break
recommend_topic_list
.
extend
(
topic_id_list
)
have_read_topic_id_list
.
extend
(
recommend_topic_list
)
topic_id_list
.
extend
(
recommend_topic_list
)
# recommend_topic_list.extend(topic_id_list)
have_read_topic_id_list
.
extend
(
topic_id_list
)
if
len
(
have_read_topic_id_list
)
>
30000
:
cut_len
=
len
(
have_read_topic_id_list
)
-
30000
have_read_topic_id_list
=
have_read_topic_id_list
[
cut_len
:]
...
...
@@ -148,7 +149,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# 每个session key保存15分钟
redis_client
.
expire
(
redis_key
,
60
*
60
*
24
*
30
)
return
recommend_topic
_list
return
topic_id
_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
...
...
trans2es/type_info.py
View file @
b3c627a6
...
...
@@ -11,6 +11,8 @@ from libs.es import ESPerform
import
elasticsearch
import
elasticsearch.helpers
import
sys
from
libs.cache
import
redis_client
import
copy
from
trans2es.models
import
topic
,
user
,
pick_celebrity
,
group
,
celebrity
,
tag
,
contrast_similar
,
pictorial
from
trans2es.utils.user_transfer
import
UserTransfer
...
...
@@ -22,7 +24,6 @@ from trans2es.utils.pictorial_transfer import PictorialTransfer
from
trans2es.utils.celebrity_transfer
import
CelebrityTransfer
from
trans2es.utils.tag_transfer
import
TagTransfer
from
trans2es.utils.contrast_similar_transfer
import
Contrast_Similar_Transfer
from
libs.es
import
ESPerform
__es
=
None
...
...
@@ -63,6 +64,7 @@ class TypeInfo(object):
self
.
round_insert_chunk_size
=
round_insert_chunk_size
self
.
round_insert_period
=
round_insert_period
self
.
logic_database_id
=
logic_database_id
self
.
physical_topic_star
=
"physical:topic_star"
@property
def
query
(
self
):
...
...
@@ -140,9 +142,24 @@ class TypeInfo(object):
pk
,
))
else
:
data_list
.
append
(
data
)
if
self
.
type
==
"topic"
and
instance
.
content_level
and
int
(
instance
.
content_level
)
>=
4
:
topic_data_high_star_list
.
append
(
data
)
if
data
:
data_list
.
append
(
data
)
ori_topic_star
=
redis_client
.
hget
(
self
.
physical_topic_star
,
data
[
"id"
])
if
not
ori_topic_star
:
redis_client
.
hset
(
self
.
physical_topic_star
,
data
[
"id"
],
data
[
"content_level"
])
else
:
int_ori_topic_star
=
int
(
str
(
ori_topic_star
,
encoding
=
"utf-8"
))
if
int_ori_topic_star
!=
data
[
"content_level"
]:
old_data
=
copy
.
deepcopy
(
data
)
old_data
[
"is_online"
]
=
False
old_data
[
"is_deleted"
]
=
True
old_data
[
"content_level"
]
=
ori_topic_star
data_list
.
append
(
old_data
)
redis_client
.
hset
(
self
.
physical_topic_star
,
data
[
"id"
],
data
[
"content_level"
])
# if self.type=="topic" and instance.content_level and int(instance.content_level)>=4:
# topic_data_high_star_list.append(data)
return
(
data_list
,
topic_data_high_star_list
)
...
...
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