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
c0408bd6
Commit
c0408bd6
authored
Jan 07, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alpha1.2
parent
da1d0d49
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
8 deletions
+10
-8
common.py
search/utils/common.py
+2
-2
topic.py
search/utils/topic.py
+6
-4
topic.py
search/views/topic.py
+2
-2
No files found.
search/utils/common.py
View file @
c0408bd6
...
...
@@ -28,10 +28,10 @@ class TopicDocumentField(object):
class
TopicPageType
(
object
):
# 首页推荐
HOME_RECOMMEND
=
0
HOME_RECOMMEND
=
1
# 发现页面
FIND_PAGE
=
1
FIND_PAGE
=
2
def
time_consuming_decorator
(
func
):
def
time_consuming
(
*
args
,
**
kwargs
):
...
...
search/utils/topic.py
View file @
c0408bd6
...
...
@@ -238,7 +238,7 @@ class TopicUtils(object):
return
[]
@classmethod
def
get_topic_detail_recommend_list
(
cls
,
user_id
,
topic_id
,
topic_tag_list
,
topic_group_id
,
topic_user_id
,
offset
,
size
):
def
get_topic_detail_recommend_list
(
cls
,
user_id
,
topic_id
,
topic_tag_list
,
topic_group_id
,
topic_user_id
,
filter_topic_user_id
,
offset
,
size
):
"""
:remark 帖子详情页推荐列表,缺少按时间衰减
:param user_id:
...
...
@@ -281,9 +281,9 @@ class TopicUtils(object):
query_function_score
=
{
"query"
:{
"bool"
:{
"must"
:
{
"range"
:
{
"content_level"
:
{
"gte"
:
3
,
"lte"
:
5
}}
}
,
"must"
:
[
{
"range"
:
{
"content_level"
:
{
"gte"
:
3
,
"lte"
:
5
}
}}
]
,
"must_not"
:{
"term"
:{
"id"
:
topic_id
...
...
@@ -296,6 +296,8 @@ class TopicUtils(object):
"functions"
:
functions_list
}
if
filter_topic_user_id
:
query_function_score
[
"query"
][
"bool"
][
"must"
]
.
append
({
"term"
:
{
"user_id"
:
topic_user_id
}})
if
len
(
topic_tag_list
)
>
0
:
query_function_score
[
"query"
][
"bool"
][
"should"
]
=
{
"terms"
:{
...
...
search/views/topic.py
View file @
c0408bd6
...
...
@@ -140,7 +140,7 @@ def home_query(session_id="",user_id=-1,query="",offset=0,size=10):
@bind
(
"physical/search/topic_detail_page_recommend"
)
def
topic_detail_page_recommend
(
user_id
=-
1
,
topic_id
=-
1
,
topic_group_id
=-
1
,
topic_user_id
=-
1
,
offset
=
0
,
size
=
10
):
def
topic_detail_page_recommend
(
user_id
=-
1
,
topic_id
=-
1
,
topic_group_id
=-
1
,
topic_user_id
=-
1
,
filter_topic_user_id
=
False
,
offset
=
0
,
size
=
10
):
"""
:remark:帖子详情页推荐策略,缺少第一个卡片策略
:param user_id:
...
...
@@ -156,7 +156,7 @@ def topic_detail_page_recommend(user_id=-1,topic_id=-1,topic_group_id=-1,topic_u
# 获取帖子标签列表
topic_tag_list
=
TopicUtils
.
get_topic_tag_id_list
(
topic_id
)
result_list
=
TopicUtils
.
get_topic_detail_recommend_list
(
user_id
,
topic_id
,
topic_tag_list
,
topic_group_id
,
topic_user_id
,
offset
,
size
)
result_list
=
TopicUtils
.
get_topic_detail_recommend_list
(
user_id
,
topic_id
,
topic_tag_list
,
topic_group_id
,
topic_user_id
,
filter_topic_user_id
,
offset
,
size
)
recommend_topic_ids_list
=
list
()
if
len
(
result_list
)
>
0
:
recommend_topic_ids_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_list
]
...
...
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