Commit c7543fdf authored by lixiaofang's avatar lixiaofang

修改获取数据的大

parent b7fbe33c
......@@ -36,27 +36,7 @@ def search_hotword(device_id=-1):
results_registr_tag = RegisterShowTag.objects.filter(is_deleted=False, is_online=1).count()
# 获取符合条件的核心词
q = {}
q["query"] = {
"bool": {
"must": [
{"term": {
"is_online": True
}},
{"term": {
"collection": 1
}
}
]
}
}
es_cli_obj = ESPerform.get_cli()
result_dict = ESPerform.get_search_results(es_cli_obj, "tag", q, 0, 10000)
logging.info("get result_dict:%s" % result_dict)
results_tag = result_dict["hits"]["total"]
logging.info("get totoal:%s" % results_tag)
# results_tag = Tag.objects.filter(is_online=True, collection=1).count()
results_tag = Tag.objects.filter(is_online=True, collection=1).count()
tag_id = random.sample(range(1, results_registr_tag), 1)
results_tag_chose = Tag.objects.filter(id__in=tag_id).values_list("name", flat=True)
for i in results_tag_chose:
......
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