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
a02815cf
Commit
a02815cf
authored
Mar 13, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
6505cb0a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
topic.py
search/utils/topic.py
+1
-1
topic.py
search/views/topic.py
+2
-2
trans2es_data2es_parallel.py
trans2es/management/commands/trans2es_data2es_parallel.py
+1
-1
No files found.
search/utils/topic.py
View file @
a02815cf
...
@@ -121,7 +121,7 @@ class TopicUtils(object):
...
@@ -121,7 +121,7 @@ class TopicUtils(object):
return
{}
return
{}
@classmethod
@classmethod
def
get_recommend_topic_ids
(
cls
,
tag_id
,
user
_id
,
offset
,
size
,
query
=
None
,
query_type
=
TopicPageType
.
FIND_PAGE
,
filter_topic_id_list
=
[],
test_score
=
False
,
must_topic_id_list
=
[],
recommend_tag_list
=
[],
user_similar_score_list
=
[]):
def
get_recommend_topic_ids
(
cls
,
user_id
,
tag
_id
,
offset
,
size
,
query
=
None
,
query_type
=
TopicPageType
.
FIND_PAGE
,
filter_topic_id_list
=
[],
test_score
=
False
,
must_topic_id_list
=
[],
recommend_tag_list
=
[],
user_similar_score_list
=
[]):
"""
"""
:需增加打散逻辑
:需增加打散逻辑
:remark:获取首页推荐帖子列表
:remark:获取首页推荐帖子列表
...
...
search/views/topic.py
View file @
a02815cf
...
@@ -26,7 +26,7 @@ def get_discover_page_topic_ids(user_id,device_id,size,query_type=TopicPageType.
...
@@ -26,7 +26,7 @@ def get_discover_page_topic_ids(user_id,device_id,size,query_type=TopicPageType.
have_read_topic_id_list
=
json
.
loads
(
redis_field_val_list
[
0
])
if
redis_field_val_list
[
0
]
else
[]
have_read_topic_id_list
=
json
.
loads
(
redis_field_val_list
[
0
])
if
redis_field_val_list
[
0
]
else
[]
recommend_topic_ids
=
[]
recommend_topic_ids
=
[]
topic_id_dict
=
TopicUtils
.
get_recommend_topic_ids
(
tag_id
=
0
,
user_id
=
user_id
,
offset
=
0
,
size
=
size
,
query_type
=
query_type
,
filter_topic_id_list
=
have_read_topic_id_list
)
topic_id_dict
=
TopicUtils
.
get_recommend_topic_ids
(
user_id
=
user_id
,
tag_id
=
0
,
offset
=
0
,
size
=
size
,
query_type
=
query_type
,
filter_topic_id_list
=
have_read_topic_id_list
)
for
topic_id
in
topic_id_dict
:
for
topic_id
in
topic_id_dict
:
recommend_topic_ids
.
append
(
topic_id
)
recommend_topic_ids
.
append
(
topic_id
)
...
@@ -75,7 +75,7 @@ def get_home_recommend_topic_ids(user_id,device_id,tag_id,offset,size,query=None
...
@@ -75,7 +75,7 @@ def get_home_recommend_topic_ids(user_id,device_id,tag_id,offset,size,query=None
redis_user_similar_score_redis_val
=
redis_client
.
get
(
user_similar_score_redis_key
)
redis_user_similar_score_redis_val
=
redis_client
.
get
(
user_similar_score_redis_key
)
user_similar_score_redis_list
=
json
.
loads
(
redis_user_similar_score_redis_val
)
if
redis_user_similar_score_redis_val
else
[]
user_similar_score_redis_list
=
json
.
loads
(
redis_user_similar_score_redis_val
)
if
redis_user_similar_score_redis_val
else
[]
topic_id_dict
=
TopicUtils
.
get_recommend_topic_ids
(
tag_id
,
user
_id
,
offset
,
size
*
size
,
query
,
query_type
,
filter_topic_id_list
=
have_read_topic_id_list
,
recommend_tag_list
=
recommend_tag_list
,
user_similar_score_list
=
user_similar_score_redis_list
)
topic_id_dict
=
TopicUtils
.
get_recommend_topic_ids
(
user_id
,
tag
_id
,
offset
,
size
*
size
,
query
,
query_type
,
filter_topic_id_list
=
have_read_topic_id_list
,
recommend_tag_list
=
recommend_tag_list
,
user_similar_score_list
=
user_similar_score_redis_list
)
have_read_group_id_set
=
set
()
have_read_group_id_set
=
set
()
have_read_user_id_set
=
set
()
have_read_user_id_set
=
set
()
unread_topic_id_dict
=
dict
()
unread_topic_id_dict
=
dict
()
...
...
trans2es/management/commands/trans2es_data2es_parallel.py
View file @
a02815cf
...
@@ -129,7 +129,7 @@ class Command(BaseCommand):
...
@@ -129,7 +129,7 @@ class Command(BaseCommand):
def
generate_topic_score_detail
(
self
):
def
generate_topic_score_detail
(
self
):
try
:
try
:
topic_id_dict
=
TopicUtils
.
get_recommend_topic_ids
(
0
,
241432787
,
0
,
500
,
query_type
=
TopicPageType
.
HOME_RECOMMEND
,
test_score
=
True
)
topic_id_dict
=
TopicUtils
.
get_recommend_topic_ids
(
241432787
,
0
,
0
,
500
,
query_type
=
TopicPageType
.
HOME_RECOMMEND
,
test_score
=
True
)
for
topic_id
in
topic_id_dict
:
for
topic_id
in
topic_id_dict
:
offline_score
=
0.0
offline_score
=
0.0
...
...
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