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
5192412e
Commit
5192412e
authored
Feb 28, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'linUCB' into 'master'
modify linUCB See merge request
!132
parents
0d97ebee
ed2ec085
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
collect_data.py
linucb/views/collect_data.py
+1
-1
topic.py
search/utils/topic.py
+1
-1
topic.py
search/views/topic.py
+7
-3
No files found.
linucb/views/collect_data.py
View file @
5192412e
...
...
@@ -59,7 +59,7 @@ class CollectData(object):
if
len
(
recommend_tag_list
)
>
0
:
tag_recommend_redis_key
=
self
.
linucb_recommend_redis_prefix
+
str
(
device_id
)
redis_client
.
set
(
tag_recommend_redis_key
,
recommend_tag_list
)
redis_client
.
set
(
tag_recommend_redis_key
,
json
.
dumps
(
recommend_tag_list
)
)
# Todo:设置过期时间,调研set是否支持
redis_client
.
expire
(
tag_recommend_redis_key
,
7
*
24
*
60
*
60
)
...
...
search/utils/topic.py
View file @
5192412e
...
...
@@ -93,7 +93,7 @@ class TopicUtils(object):
return
[]
@classmethod
def
get_topic_tag_info
(
cls
,
offset
,
size
,
topic_id_list
):
def
get_topic_tag_info
(
cls
,
offset
,
size
,
topic_id_list
,
user_id
):
try
:
q
=
{
"query"
:{
...
...
search/views/topic.py
View file @
5192412e
...
...
@@ -59,7 +59,11 @@ def get_home_recommend_topic_ids(user_id,device_id,offset,size,query=None,query_
redis_field_val_list
=
redis_client
.
hmget
(
redis_key
,
redis_field_list
)
tag_recommend_redis_key
=
"physical:linucb:tag_recommend:device_id:"
+
str
(
device_id
)
recommend_tag_list
=
redis_client
.
get
(
tag_recommend_redis_key
)
or
[]
recommend_tag_list
=
[]
# tag_recommend_val = redis_client.get(tag_recommend_redis_key)
# if tag_recommend_val:
# recommend_tag_list = json.loads(tag_recommend_val)
recommend_topic_ids
=
[]
have_read_topic_id_list
=
list
()
...
...
@@ -209,9 +213,9 @@ def get_home_recommend_topic_ids(user_id,device_id,offset,size,query=None,query_
"""
@bind
(
"physical/search/query_tag_id_by_topic"
)
def
query_tag_id_by_topic
(
offset
=
0
,
size
=
10
,
topic_id_list
=
[]):
def
query_tag_id_by_topic
(
offset
=
0
,
size
=
10
,
topic_id_list
=
[]
,
user_id
=-
1
):
try
:
return
TopicUtils
.
get_topic_tag_info
(
offset
,
size
,
topic_id_list
)
return
TopicUtils
.
get_topic_tag_info
(
offset
,
size
,
topic_id_list
,
user_id
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{}
...
...
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