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
89de023a
Commit
89de023a
authored
May 17, 2019
by
黄凯
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hk_now' into 'test'
fix bug See merge request alpha/physical!340
parents
5aa663c1
0172e069
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
topic.py
search/views/topic.py
+11
-3
No files found.
search/views/topic.py
View file @
89de023a
...
...
@@ -157,11 +157,16 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
redis_client
.
hmset
(
redis_key
,
redis_dict
)
# 每个session key保存60天
redis_client
.
expire
(
redis_key
,
60
*
60
*
24
*
60
)
if
usefulrecall
!=
-
1
:
return
recommend_topic_list
,
rank_topic_id_list
,
useful_topic_id_list
else
:
return
recommend_topic_list
,
rank_topic_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[],[]
if
usefulrecall
!=
-
1
:
return
[],[],[]
else
:
return
[],
[]
@bind
(
"physical/search/query_tag_id_by_topic"
)
...
...
@@ -212,11 +217,14 @@ def home_recommend(device_id="", user_id=-1, offset=0, size=10, query_type=Topic
recommend_topic_ids
=
have_read_topic_id_list
[
0
:
size
]
else
:
if
usefulrecall
!=
-
1
:
recommend_topic_ids
,
rank_topic_ids
,
useful_topic_ids
=
get_home_recommend_topic_ids
(
user_id
,
device_id
,
tag_id
=
0
,
offset
=
0
,
size
=
size
,
query_type
=
query_type
,
promote_topic_list
=
promote_topic_list
,
usefulrecall
=
usefulrecall
)
if
usefulrecall
!=
-
1
:
return
{
"linucb_topic_ids"
:
recommend_topic_ids
,
"rank_topic_ids"
:
rank_topic_ids
,
"useful_topic_ids"
:
useful_topic_ids
}
else
:
recommend_topic_ids
,
rank_topic_ids
=
get_home_recommend_topic_ids
(
user_id
,
device_id
,
tag_id
=
0
,
offset
=
0
,
size
=
size
,
query_type
=
query_type
,
promote_topic_list
=
promote_topic_list
)
return
{
"linucb_topic_ids"
:
recommend_topic_ids
,
"rank_topic_ids"
:
rank_topic_ids
}
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