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
a7cee0ca
Commit
a7cee0ca
authored
Aug 23, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
batch_user增加query为空的兼容
parent
356f005d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
user.py
search/utils/user.py
+11
-11
No files found.
search/utils/user.py
View file @
a7cee0ca
...
...
@@ -275,21 +275,21 @@ class UserUtils(object):
for
query_item
in
batch_query_list
:
query_body
+=
"{}
\n
{}
\n
"
.
format
(
json
.
dumps
(
search_header_dict
),
json
.
dumps
(
query_item
))
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
sub_index_name
=
"user"
,
query_body
=
query_body
,
batch_search
=
True
)
ret_dict
=
dict
()
user_index
=
0
for
res_item
in
result_dict
[
"responses"
]:
recommend_user_list
=
list
()
for
item
in
res_item
[
"hits"
][
"hits"
]:
recommend_user_list
.
append
(
item
[
"_source"
][
"user_id"
])
if
len
(
query_body
)
>
0
:
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
sub_index_name
=
"user"
,
query_body
=
query_body
,
batch_search
=
True
)
user_index
=
0
for
res_item
in
result_dict
[
"responses"
]:
recommend_user_list
=
list
()
for
item
in
res_item
[
"hits"
][
"hits"
]:
recommend_user_list
.
append
(
item
[
"_source"
][
"user_id"
])
logging
.
info
(
"duan add,attention_user_id_list:
%
s,user_index:
%
d"
%
(
str
(
attention_user_id_list
),
user_index
))
ret_dict
[
str
(
attention_user_id_list
[
user_index
])]
=
recommend_user_list
user_index
+=
1
logging
.
info
(
"duan add,attention_user_id_list:
%
s,user_index:
%
d"
%
(
str
(
attention_user_id_list
),
user_index
))
ret_dict
[
str
(
attention_user_id_list
[
user_index
])]
=
recommend_user_list
user_index
+=
1
logging
.
info
(
"duan add,ret_dict:
%
s"
%
str
(
ret_dict
))
return
ret_dict
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
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