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
钟尚武
physical
Commits
98e4ffae
Commit
98e4ffae
authored
Mar 13, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
7ddf7912
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
topic.py
search/views/topic.py
+4
-4
No files found.
search/views/topic.py
View file @
98e4ffae
...
...
@@ -42,7 +42,7 @@ def get_discover_page_topic_ids(user_id,device_id,size,query_type=TopicPageType.
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
get_home_recommend_topic_ids
(
user_id
,
device_id
,
offset
,
size
,
query
=
None
,
query_type
=
TopicPageType
.
HOME_RECOMMEND
):
def
get_home_recommend_topic_ids
(
tag_id
,
user_id
,
device_id
,
offset
,
size
,
query
=
None
,
query_type
=
TopicPageType
.
HOME_RECOMMEND
):
try
:
if
query
is
None
:
if
user_id
==
-
1
:
...
...
@@ -75,7 +75,7 @@ def get_home_recommend_topic_ids(user_id,device_id,offset,size,query=None,query_
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
[]
topic_id_dict
=
TopicUtils
.
get_recommend_topic_ids
(
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
(
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
)
have_read_group_id_set
=
set
()
have_read_user_id_set
=
set
()
unread_topic_id_dict
=
dict
()
...
...
@@ -187,7 +187,7 @@ def discover_page(device_id="",user_id=-1,size=10):
@bind
(
"physical/search/home_query"
)
def
home_query
(
device_id
=
""
,
user_id
=-
1
,
query
=
""
,
offset
=
0
,
size
=
10
):
def
home_query
(
tag_id
=
""
,
device_id
=
""
,
user_id
=-
1
,
query
=
""
,
offset
=
0
,
size
=
10
):
"""
:remark:首页搜索,目前只推荐日记
:param session_id:
...
...
@@ -203,7 +203,7 @@ def home_query(device_id="",user_id=-1,query="",offset=0,size=10):
if
not
isinstance
(
device_id
,
str
):
device_id
=
""
recommend_topic_ids
=
get_home_recommend_topic_ids
(
user_id
,
device_id
,
offset
,
size
,
query
)
recommend_topic_ids
=
get_home_recommend_topic_ids
(
tag_id
,
user_id
,
device_id
,
offset
,
size
,
query
)
return
{
"recommend_topic_ids"
:
recommend_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