Commit ec47411b authored by 段英荣's avatar 段英荣

add batch_recommend_user

parent 1e0e4582
......@@ -261,9 +261,10 @@ class UserUtils(object):
query_body = ""
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(ESPerform.get_cli(), 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()
......@@ -271,10 +272,10 @@ class UserUtils(object):
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))
result_dict[attention_user_id_list[user_index]] = recommend_user_list
ret_dict[attention_user_id_list[user_index]] = recommend_user_list
user_index += 1
return result_dict
return ret_dict
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return dict()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment