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
3b5825bb
Commit
3b5825bb
authored
Apr 28, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify home_recommend
parent
64b074e2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
17 deletions
+20
-17
topic.py
search/utils/topic.py
+15
-11
topic.py
search/views/topic.py
+5
-6
No files found.
search/utils/topic.py
View file @
3b5825bb
...
...
@@ -177,24 +177,28 @@ class TopicUtils(object):
},
{
"filter"
:
{
"constant_score"
:{
"filter"
:{
"term"
:
{
"content_level"
:
6
}
}
}
},
"weight"
:
10
00
"weight"
:
6
00
}
]
if
len
(
user_similar_score_list
)
>
0
:
for
item
in
user_similar_score_list
[:
100
]:
score_item
=
2
+
item
[
1
]
functions_list
.
append
(
{
"filter"
:
{
"bool"
:
{
"should"
:
{
"term"
:
{
"user_id"
:
item
[
0
]}}}},
"weight"
:
score_item
,
}
)
#
if len(user_similar_score_list) > 0:
#
for item in user_similar_score_list[:100]:
#
score_item = 2 + item[1]
#
functions_list.append(
#
{
#
"filter": {"bool": {
#
"should": {"term": {"user_id": item[0]}}}},
#
"weight": score_item,
#
}
#
)
if
len
(
attention_user_id_list
)
>
0
:
functions_list
.
append
(
...
...
search/views/topic.py
View file @
3b5825bb
...
...
@@ -73,10 +73,10 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
if
offset
>
0
:
# 首次搜索时不需要过滤已读
have_read_topic_id_list
=
list
(
json
.
loads
(
redis_field_val_list
[
0
]))
user_similar_score_redis_key
=
"physical:user_similar_score:user_id:"
+
str
(
user_id
)
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_key = "physical:user_similar_score:user_id:" + str(user_id)
#
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 []
attention_tag_list
=
list
()
recommend_topic_list
=
list
()
...
...
@@ -113,8 +113,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
topic_id_list
=
list
()
rank_topic_id_list
=
TopicUtils
.
get_recommend_topic_ids
(
user_id
=
user_id
,
tag_id
=
tag_id
,
offset
=
0
,
size
=
size
,
single_size
=
size
,
query
=
query
,
query_type
=
query_type
,
filter_topic_id_list
=
have_read_topic_id_list
,
user_similar_score_list
=
user_similar_score_redis_list
,
index_type
=
"topic-high-star"
,
routing
=
"4,5,6"
,
attention_tag_list
=
attention_tag_list
)
filter_topic_id_list
=
have_read_topic_id_list
,
index_type
=
"topic-high-star"
,
routing
=
"4,5,6"
,
attention_tag_list
=
attention_tag_list
)
if
len
(
recommend_topic_list
)
==
6
and
query
is
None
:
if
(
size
<
11
):
...
...
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