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
c5a99071
Commit
c5a99071
authored
Apr 11, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add user_tag_list
parent
465e2c83
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
topic.py
search/utils/topic.py
+3
-3
topic.py
search/views/topic.py
+2
-2
No files found.
search/utils/topic.py
View file @
c5a99071
...
...
@@ -122,7 +122,7 @@ class TopicUtils(object):
@classmethod
def
get_recommend_topic_ids
(
cls
,
user_id
,
tag_id
,
offset
,
size
,
single_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
=
[],
index_type
=
"topic"
,
routing
=
None
,
default
_tag_list
=
[]):
user_similar_score_list
=
[],
index_type
=
"topic"
,
routing
=
None
,
attention
_tag_list
=
[]):
"""
:需增加打散逻辑
:remark:获取首页推荐帖子列表
...
...
@@ -216,11 +216,11 @@ class TopicUtils(object):
# )
# query_tag_term_list = cls.___get_should_term_list(user_tag_list)
if
len
(
default
_tag_list
)
>
0
:
if
len
(
attention
_tag_list
)
>
0
:
functions_list
.
append
(
{
"filter"
:
{
"bool"
:
{
"should"
:
{
"terms"
:
{
"tag_list"
:
default
_tag_list
}}}},
"should"
:
{
"terms"
:
{
"tag_list"
:
attention
_tag_list
}}}},
"weight"
:
60
}
)
...
...
search/views/topic.py
View file @
c5a99071
...
...
@@ -92,14 +92,14 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
redis_tag_data
=
redis_client
.
hget
(
"physical:linucb:register_user_tag_info"
,
user_id
)
default
_tag_list
=
json
.
loads
(
redis_tag_data
)
if
redis_tag_data
else
[]
attention
_tag_list
=
json
.
loads
(
redis_tag_data
)
if
redis_tag_data
else
[]
size
=
size
-
len
(
recommend_topic_list
)
topic_id_list
=
TopicUtils
.
get_recommend_topic_ids
(
user_id
=
user_id
,
tag_id
=
tag_id
,
offset
=
offset
,
size
=
size
,
single_size
=
size
,
query
=
query
,
query_type
=
query_type
,
filter_topic_id_list
=
have_read_topic_id_list
,
recommend_tag_list
=
recommend_topic_list
,
user_similar_score_list
=
user_similar_score_redis_list
,
index_type
=
"topic"
,
routing
=
"4,5"
,
default_tag_list
=
default
_tag_list
)
user_similar_score_list
=
user_similar_score_redis_list
,
index_type
=
"topic"
,
routing
=
"4,5"
,
attention_tag_list
=
attention
_tag_list
)
have_read_group_id_set
=
set
()
have_read_user_id_set
=
set
()
unread_topic_id_dict
=
dict
()
...
...
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