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
98743315
Commit
98743315
authored
Apr 30, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify home_recommend return
parent
086b6ef5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
topic.py
search/utils/topic.py
+10
-8
topic.py
search/views/topic.py
+3
-3
No files found.
search/utils/topic.py
View file @
98743315
...
@@ -259,14 +259,16 @@ class TopicUtils(object):
...
@@ -259,14 +259,16 @@ class TopicUtils(object):
query_function_score
[
"query"
][
"bool"
][
"must_not"
]
=
[
query_function_score
[
"query"
][
"bool"
][
"must_not"
]
=
[
{
"terms"
:{
"id"
:
filter_topic_id_list
}}
{
"terms"
:{
"id"
:
filter_topic_id_list
}}
]
]
if
"must_not"
in
query_function_score
[
"query"
][
"bool"
]:
query_function_score
[
"query"
][
"bool"
][
"must_not"
]
+=
[
if
len
(
linucb_user_id_list
)
>
0
:
{
"terms"
:
{
"user_id"
:
linucb_user_id_list
}}
if
"must_not"
in
query_function_score
[
"query"
][
"bool"
]:
]
query_function_score
[
"query"
][
"bool"
][
"must_not"
]
+=
[
else
:
{
"terms"
:
{
"user_id"
:
linucb_user_id_list
}}
query_function_score
[
"query"
][
"bool"
][
"must_not"
]
=
[
]
{
"terms"
:
{
"user_id"
:
linucb_user_id_list
}}
else
:
]
query_function_score
[
"query"
][
"bool"
][
"must_not"
]
=
[
{
"terms"
:
{
"user_id"
:
linucb_user_id_list
}}
]
if
query
is
not
None
:
# 搜索帖子
if
query
is
not
None
:
# 搜索帖子
multi_fields
=
{
multi_fields
=
{
'description'
:
200
,
'description'
:
200
,
...
...
search/views/topic.py
View file @
98743315
...
@@ -152,7 +152,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
...
@@ -152,7 +152,7 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
return
recommend_topic_list
,
rank_topic_id_list
return
recommend_topic_list
,
rank_topic_id_list
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
return
[]
,[]
@bind
(
"physical/search/query_tag_id_by_topic"
)
@bind
(
"physical/search/query_tag_id_by_topic"
)
...
@@ -252,8 +252,8 @@ def home_query(device_id="", tag_id=-1, user_id=-1, query="", offset=0, size=10)
...
@@ -252,8 +252,8 @@ def home_query(device_id="", tag_id=-1, user_id=-1, query="", offset=0, size=10)
if
not
isinstance
(
device_id
,
str
):
if
not
isinstance
(
device_id
,
str
):
device_id
=
""
device_id
=
""
recommend_topic_
ids
=
get_home_recommend_topic_ids
(
user_id
,
device_id
,
tag_id
,
offset
=
offset
,
size
=
size
,
query
=
query
)
recommend_topic_
list
,
rank_topic_id_list
=
get_home_recommend_topic_ids
(
user_id
,
device_id
,
tag_id
,
offset
=
offset
,
size
=
size
,
query
=
query
)
return
{
"recommend_topic_ids"
:
r
ecommend_topic_ids
}
return
{
"recommend_topic_ids"
:
r
ank_topic_id_list
}
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"recommend_topic_ids"
:
[]}
return
{
"recommend_topic_ids"
:
[]}
...
...
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