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
0a141a87
Commit
0a141a87
authored
Aug 17, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify bug
parent
cba922ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
topic.py
search/utils/topic.py
+6
-3
topic.py
search/views/topic.py
+6
-5
No files found.
search/utils/topic.py
View file @
0a141a87
...
...
@@ -160,6 +160,7 @@ class TopicUtils(object):
q
=
dict
()
ret_data_list
=
list
()
topic_id_list
=
list
()
q
[
"query"
]
=
dict
()
...
...
@@ -452,12 +453,14 @@ class TopicUtils(object):
offset
=
offset
,
size
=
size
,
routing
=
routing
)
for
item
in
result_dict
[
"hits"
]:
topic_id_list
.
append
({
"id"
:
item
[
"_source"
][
"id"
],
"highlight"
:
item
.
get
(
"highlight"
,
{})})
ret_data_list
.
append
({
"id"
:
item
[
"_source"
][
"id"
],
"highlight"
:
item
.
get
(
"highlight"
,
{})})
topic_id_list
.
append
(
item
[
"_source"
][
"id"
])
return
topic_id_list
return
topic_id_list
,
ret_data_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
list
()
return
list
()
,
list
()
@classmethod
def
userful_tag_topic_list
(
cls
,
user_id
,
have_read_topic_list
,
size
,
...
...
search/views/topic.py
View file @
0a141a87
...
...
@@ -29,7 +29,7 @@ def get_discover_page_topic_ids(user_id, device_id, size, query_type=TopicPageTy
if
have_read_topic_id_list
==
None
:
have_read_topic_id_list
=
list
()
recommend_topic_ids
=
TopicUtils
.
get_recommend_topic_ids
(
user_id
=
user_id
,
tag_id
=
0
,
offset
=
0
,
size
=
size
,
recommend_topic_ids
,
ret_data_list
=
TopicUtils
.
get_recommend_topic_ids
(
user_id
=
user_id
,
tag_id
=
0
,
offset
=
0
,
size
=
size
,
single_size
=
size
,
query_type
=
query_type
,
filter_topic_id_list
=
have_read_topic_id_list
,
...
...
@@ -160,8 +160,9 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# for topic_id in promote_recommend_topic_id_list:
# have_read_topic_id_list_add_promote.append(topic_id)
rank_topic_id_list
=
list
()
ret_data_list
=
list
()
if
size
>
0
:
rank_topic_id_list
=
TopicUtils
.
get_recommend_topic_ids
(
user_id
=
user_id
,
tag_id
=
tag_id
,
offset
=
0
,
size
=
size
,
rank_topic_id_list
,
ret_data_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
,
...
...
@@ -199,9 +200,9 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# 每个session key保存60天
redis_client
.
expire
(
redis_key
,
60
*
60
*
24
*
60
)
if
usefulrecall
!=
-
1
:
return
recommend_topic_list
,
r
ank_topic_id
_list
,
useful_topic_id_list
return
recommend_topic_list
,
r
et_data
_list
,
useful_topic_id_list
else
:
return
recommend_topic_list
,
r
ank_topic_id
_list
return
recommend_topic_list
,
r
et_data
_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
if
usefulrecall
!=
-
1
:
...
...
@@ -512,7 +513,7 @@ def query_topic_by_user_similarity(topic_similarity_score_dict, offset=0, size=1
try
:
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
,
topic_id_list
,
ret_data_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
,
index_type
=
"topic"
,
routing
=
"4,5,6"
)
...
...
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