Commit 93c98837 authored by lixiaofang's avatar lixiaofang

add

parent 5ed03864
...@@ -31,7 +31,9 @@ class TopicUtils(object): ...@@ -31,7 +31,9 @@ class TopicUtils(object):
} }
} }
q["_source"] = ["tag_list", "attention_user_id_list", "pick_user_id_list", "same_pictorial_user_id_list"] q["_source"] = {
"include": ["tag_list", "attention_user_id_list", "pick_user_id_list", "same_pictorial_user_id_list"]
}
result_dict = ESPerform.get_search_results(ESPerform.get_cli(), "user", q, offset, size) result_dict = ESPerform.get_search_results(ESPerform.get_cli(), "user", q, offset, size)
...@@ -149,12 +151,12 @@ class TopicUtils(object): ...@@ -149,12 +151,12 @@ class TopicUtils(object):
pick_user_info_list = result_dict["hits"][0]["_source"]["pick_user_id_list"] pick_user_info_list = result_dict["hits"][0]["_source"]["pick_user_id_list"]
pick_user_id_list = [item["user_id"] for item in pick_user_info_list] pick_user_id_list = [item["user_id"] for item in pick_user_info_list]
logging.info("get result_dict_hits :%s"%result_dict["hits"]) logging.info("get result_dict_hits :%s" % result_dict["hits"])
# same_group_user_info_list = result_dict["hits"][0]["_source"]["same_group_user_id_list"] # same_group_user_info_list = result_dict["hits"][0]["_source"]["same_group_user_id_list"]
# same_group_id_list = [item["user_id"] for item in same_group_user_info_list] # same_group_id_list = [item["user_id"] for item in same_group_user_info_list]
# same_group_id_list = same_group_id_list[:100] # same_group_id_list = same_group_id_list[:100]
same_pictorial_user_info_list = result_dict["hits"][0]["_source"]["same_pictorial_user_id_list"] same_pictorial_user_info_list = result_dict["hits"][0]["_source"]["same_pictorial_user_id_list"]
logging.info("get same_pictorial_user_info_list :%s"%same_pictorial_user_info_list) logging.info("get same_pictorial_user_info_list :%s" % same_pictorial_user_info_list)
same_pictorial_id_list = [item["user_id"] for item in same_pictorial_user_info_list] same_pictorial_id_list = [item["user_id"] for item in same_pictorial_user_info_list]
same_pictorial_id_list = same_pictorial_id_list[:100] same_pictorial_id_list = same_pictorial_id_list[:100]
...@@ -723,7 +725,7 @@ class TopicUtils(object): ...@@ -723,7 +725,7 @@ class TopicUtils(object):
if sorts: if sorts:
q["sort"] = sorts q["sort"] = sorts
logging.info("get query:%s"%q) logging.info("get query:%s" % q)
try: try:
result_dict = ESPerform.get_search_results( result_dict = ESPerform.get_search_results(
...@@ -732,7 +734,6 @@ class TopicUtils(object): ...@@ -732,7 +734,6 @@ class TopicUtils(object):
) )
logging.info("get result_dicts:%s" % result_dict) logging.info("get result_dicts:%s" % result_dict)
return { return {
"hits": result_dict["hits"], "hits": result_dict["hits"],
"total_count": result_dict["total_count"] "total_count": result_dict["total_count"]
......
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