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
f3b872ab
Commit
f3b872ab
authored
Mar 22, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify content_level range
parent
79bbac1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
topic.py
search/utils/topic.py
+4
-4
topic.py
search/views/topic.py
+4
-4
No files found.
search/utils/topic.py
View file @
f3b872ab
...
@@ -237,7 +237,7 @@ class TopicUtils(object):
...
@@ -237,7 +237,7 @@ class TopicUtils(object):
"query"
:
{
"query"
:
{
"bool"
:
{
"bool"
:
{
"filter"
:
[
"filter"
:
[
{
"range"
:
{
"content_level"
:
{
"gte"
:
low_content_level
,
"lte"
:
5
}}},
#
{"range": {"content_level": {"gte": low_content_level, "lte": 5}}},
{
"term"
:
{
"has_image"
:
True
}},
{
"term"
:
{
"has_image"
:
True
}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}}
{
"term"
:
{
"is_deleted"
:
False
}}
...
@@ -361,7 +361,7 @@ class TopicUtils(object):
...
@@ -361,7 +361,7 @@ class TopicUtils(object):
return
list
()
return
list
()
@classmethod
@classmethod
def
get_topic_detail_recommend_list
(
cls
,
user_id
,
topic_id
,
topic_tag_list
,
topic_group_id
,
topic_user_id
,
filter_topic_user_id
,
have_read_topic_list
,
offset
,
size
,
es_cli_obj
=
None
):
def
get_topic_detail_recommend_list
(
cls
,
user_id
,
topic_id
,
topic_tag_list
,
topic_group_id
,
topic_user_id
,
filter_topic_user_id
,
have_read_topic_list
,
offset
,
size
,
es_cli_obj
=
None
,
index_type
=
"topic"
):
"""
"""
:remark 帖子详情页推荐列表,缺少按时间衰减
:remark 帖子详情页推荐列表,缺少按时间衰减
:param user_id:
:param user_id:
...
@@ -408,7 +408,7 @@ class TopicUtils(object):
...
@@ -408,7 +408,7 @@ class TopicUtils(object):
"query"
:{
"query"
:{
"bool"
:{
"bool"
:{
"must"
:
[
"must"
:
[
{
"range"
:
{
"content_level"
:
{
"gte"
:
3
,
"lte"
:
5
}}},
#
{"range": {"content_level": {"gte": 3, "lte": 5}}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}}
{
"term"
:
{
"is_deleted"
:
False
}}
],
],
...
@@ -437,7 +437,7 @@ class TopicUtils(object):
...
@@ -437,7 +437,7 @@ class TopicUtils(object):
"includes"
:[
"id"
,
"group_id"
,
"user_id"
,
"_score"
]
"includes"
:[
"id"
,
"group_id"
,
"user_id"
,
"_score"
]
}
}
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
sub_index_name
=
"topic"
,
query_body
=
q
,
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
sub_index_name
=
index_type
,
query_body
=
q
,
offset
=
offset
,
size
=
size
)
offset
=
offset
,
size
=
size
)
return
result_dict
[
"hits"
]
return
result_dict
[
"hits"
]
...
...
search/views/topic.py
View file @
f3b872ab
...
@@ -27,7 +27,7 @@ def get_discover_page_topic_ids(user_id, device_id, size, query_type=TopicPageTy
...
@@ -27,7 +27,7 @@ def get_discover_page_topic_ids(user_id, device_id, size, query_type=TopicPageTy
recommend_topic_ids
=
TopicUtils
.
get_recommend_topic_ids
(
user_id
=
user_id
,
tag_id
=
0
,
offset
=
0
,
size
=
size
,
single_size
=
size
,
recommend_topic_ids
=
TopicUtils
.
get_recommend_topic_ids
(
user_id
=
user_id
,
tag_id
=
0
,
offset
=
0
,
size
=
size
,
single_size
=
size
,
query_type
=
query_type
,
query_type
=
query_type
,
filter_topic_id_list
=
have_read_topic_id_list
)
filter_topic_id_list
=
have_read_topic_id_list
,
index_type
=
"topic-high-star"
)
have_read_topic_id_list
.
extend
(
recommend_topic_ids
)
have_read_topic_id_list
.
extend
(
recommend_topic_ids
)
...
@@ -84,7 +84,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
...
@@ -84,7 +84,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
single_size
=
size
,
query
=
query
,
query_type
=
query_type
,
single_size
=
size
,
query
=
query
,
query_type
=
query_type
,
filter_topic_id_list
=
have_read_topic_id_list
,
filter_topic_id_list
=
have_read_topic_id_list
,
recommend_tag_list
=
recommend_tag_list
,
recommend_tag_list
=
recommend_tag_list
,
user_similar_score_list
=
user_similar_score_redis_list
)
user_similar_score_list
=
user_similar_score_redis_list
,
index_type
=
"topic-high-star"
)
have_read_group_id_set
=
set
()
have_read_group_id_set
=
set
()
have_read_user_id_set
=
set
()
have_read_user_id_set
=
set
()
unread_topic_id_dict
=
dict
()
unread_topic_id_dict
=
dict
()
...
@@ -273,7 +273,7 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_gro
...
@@ -273,7 +273,7 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_gro
result_list
=
TopicUtils
.
get_topic_detail_recommend_list
(
user_id
,
topic_id
,
topic_tag_list
,
topic_group_id
,
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
,
topic_user_id
,
filter_topic_user_id
,
have_read_topic_list
,
offset
,
size
,
es_cli_obj
)
have_read_topic_list
,
offset
,
size
,
es_cli_obj
,
index_type
=
"topic-high-star"
)
recommend_topic_ids_list
=
list
()
recommend_topic_ids_list
=
list
()
if
len
(
result_list
)
>
0
:
if
len
(
result_list
)
>
0
:
recommend_topic_ids_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_list
]
recommend_topic_ids_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_list
]
...
@@ -347,7 +347,7 @@ def query_topic_by_user_similarity(topic_similarity_score_dict, offset=0, size=1
...
@@ -347,7 +347,7 @@ def query_topic_by_user_similarity(topic_similarity_score_dict, offset=0, size=1
must_topic_id_list
=
list
(
topic_similarity_score_dict
.
keys
())
must_topic_id_list
=
list
(
topic_similarity_score_dict
.
keys
())
topic_id_list
=
TopicUtils
.
get_recommend_topic_ids
(
tag_id
=
0
,
user_id
=-
1
,
offset
=
offset
,
size
=
size
,
single_size
=
size
,
topic_id_list
=
TopicUtils
.
get_recommend_topic_ids
(
tag_id
=
0
,
user_id
=-
1
,
offset
=
offset
,
size
=
size
,
single_size
=
size
,
must_topic_id_list
=
must_topic_id_list
)
must_topic_id_list
=
must_topic_id_list
,
index_type
=
"topic-high-star"
)
return
{
"recommend_topic_ids"
:
topic_id_list
}
return
{
"recommend_topic_ids"
:
topic_id_list
}
except
:
except
:
...
...
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