Commit 33ff44e9 authored by lixiaofang's avatar lixiaofang

add

parent 9d6513d9
...@@ -108,7 +108,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10): ...@@ -108,7 +108,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
"include": ["id", "pictorial_id", "tag_list"] "include": ["id", "pictorial_id", "tag_list"]
} }
result_dict = ESPerform.get_search_results(es_cli_obj, "topic", q, offset, size) result_dict = ESPerform.get_search_results(es_cli_obj, "topic", q, offset, size)
logging.info("get result_dict:%s"%result_dict) logging.info("get result_dict:%s" % result_dict)
pict_pictorial_ids_list = [] pict_pictorial_ids_list = []
topic_tag_list = [] topic_tag_list = []
pictorial_id_list = [] pictorial_id_list = []
...@@ -135,13 +135,13 @@ def pictorial_topic(topic_id=-1, offset=0, size=10): ...@@ -135,13 +135,13 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
for item in result_dict["hits"]: for item in result_dict["hits"]:
pictorial_id = item["_source"]["id"] pictorial_id = item["_source"]["id"]
pictorial_id_list.append(pictorial_id) pictorial_id_list.append(pictorial_id)
logging.info("get pictorial_id_list:%s"%pictorial_id_list) logging.info("get pictorial_id_list:%s" % pictorial_id_list)
logging.info("get topic_tag_list:%s"%topic_tag_list) logging.info("get topic_tag_list:%s" % topic_tag_list)
if len(pict_pictorial_ids_list) < 10: if len(pict_pictorial_ids_list) < 10:
q["query"] = { q["query"] = {
"bool":{ "bool": {
"must":{ "must":[{
"term": { "term": {
"is_online": True "is_online": True
}, },
...@@ -149,9 +149,11 @@ def pictorial_topic(topic_id=-1, offset=0, size=10): ...@@ -149,9 +149,11 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
"is_delete": False "is_delete": False
}, },
"terms": { "terms": {
"tag_id": [211302,195275,195246, 317175, 274332,96, 345697, 336486,473577,336051,847034,482012]#topic_tag_list "tag_id": [211302, 195275, 195246, 317175, 274332, 96, 345697, 336486, 473577, 336051,
847034, 482012]
# topic_tag_list
} }
} }]
} }
} }
...@@ -164,8 +166,8 @@ def pictorial_topic(topic_id=-1, offset=0, size=10): ...@@ -164,8 +166,8 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
} }
} }
q["form"]=0 q["form"] = 0
q["size"] =10 q["size"] = 10
result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", q, offset, size) result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", q, offset, size)
if len(result_dict["hits"]) > 0: if len(result_dict["hits"]) > 0:
...@@ -173,7 +175,6 @@ def pictorial_topic(topic_id=-1, offset=0, size=10): ...@@ -173,7 +175,6 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
logging.info("get result_dict tag:%s" % result_dict) logging.info("get result_dict tag:%s" % result_dict)
return {"pictorial_ids_list": pictorial_id_list} return {"pictorial_ids_list": pictorial_id_list}
else: 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