Commit 27d86903 authored by lixiaofang's avatar lixiaofang

add logging

parent e4f1bd4e
......@@ -113,8 +113,10 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
topic_tag_list = []
pictorial_id_list = []
if len(result_dict["hits"]) > 0:
pict_pictorial_ids_list.append([item["_source"]["pictorial_id"] for item in result_dict["hits"]]) #
topic_tag_list.append([item["_source"]["tag_list"] for item in result_dict["hits"]] )#
for item in result_dict["hits"]:
pictorial_id = item["_source"]["pictorial_id"]
topic_tag_list = item["_source"]["tag_list"]
pict_pictorial_ids_list.append(pictorial_id) #
q["query"] = {
"terms": {
......@@ -132,8 +134,12 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
}
result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", q, offset, size)
if len(result_dict["hits"]) > 0:
pictorial_id_list = [item["_source"]["id"] for item in result_dict["hits"]] #
for item in result_dict["hits"]:
pictorial_id = item["_source"]["id"]
pictorial_id_list.append(pictorial_id)
logging.info("get pictorial_id_listt:%s" % pictorial_id_list)
logging.info("get topic_tag_list:%s" % topic_tag_list)
if len(pict_pictorial_ids_list) < 10:
q["query"] = {
"terms": {
......@@ -149,17 +155,13 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
}
}
logging.info("get pictorial query:%s"%q)
logging.info("get pictorial query:%s" % q)
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.append([item["_source"]["id"] for item in result_dict["hits"]]) #
pictorial_id_list.append(item["_source"]["id"] for item in result_dict["hits"]) #
for i in pictorial_id_list:
pict_pictorial_ids_list.append(i)
return {"pictorial_ids_list": pict_pictorial_ids_list}
return {"pictorial_ids_list": pictorial_id_list}
else:
......
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