Commit fd894747 authored by lixiaofang's avatar lixiaofang

add query

parent 2a5e3727
...@@ -139,6 +139,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10): ...@@ -139,6 +139,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
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:
num = 10-len(pict_pictorial_ids_list)
q["query"] = { q["query"] = {
"bool": { "bool": {
"must": [{ "must": [{
...@@ -164,7 +165,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10): ...@@ -164,7 +165,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
}} }}
q["from"] = 0 q["from"] = 0
q["size"] = 3 q["size"] = num
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:
......
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