Commit e68afc7d authored by lixiaofang's avatar lixiaofang

add gropu

parent 455eaed0
......@@ -109,15 +109,16 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
}
result_dict = ESPerform.get_search_results(es_cli_obj, "topic", q, offset, size)
pictorial_ids_list = []
pict_pictorial_ids_list = []
topic_tag_list = []
pictorial_id_list = []
if len(result_dict["hits"]) > 0:
pictorial_ids_list = [item["_source"]["pictorial_id"] for item in result_dict["hits"]] #
pict_pictorial_ids_list = [item["_source"]["pictorial_id"] for item in result_dict["hits"]] #
topic_tag_list = [item["_source"]["tag_list"] for item in result_dict["hits"]] #
q["query"] = {
"terms": {
"id": pictorial_ids_list
"id": pict_pictorial_ids_list
}
}
q["_source"] = {
......@@ -130,13 +131,10 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
}
result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", q, offset, size)
pictorial_id_list = []
if len(result_dict["hits"]) > 0:
pictorial_id_list = [item["_source"]["id"] for item in result_dict["hits"]] #
pictorial_ids_list.append(pictorial_id_list)
if len(pictorial_ids_list) < 10:
if len(pict_pictorial_ids_list) < 10:
q["query"] = {
"terms": {
"tag_id": topic_tag_list
......@@ -157,13 +155,15 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
if len(result_dict["hits"]) > 0:
pictorial_id_list = [item["_source"]["id"] for item in result_dict["hits"]] #
pictorial_ids_list.append(pictorial_id_list)
for i in pictorial_id_list:
pict_pictorial_ids_list.append(i)
return {"pictorial_ids_list": pictorial_ids_list}
return {"pictorial_ids_list": pict_pictorial_ids_list}
else:
return {"pictorial_ids_list": pictorial_ids_list}
return {"pictorial_ids_list": pictorial_id_list}
except:
......
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