Commit 5a294cfa authored by lixiaofang's avatar lixiaofang

sheer_user_id

parent 57c802a9
......@@ -33,9 +33,29 @@ def search_hotword(device_id=-1):
try:
all_tag_name_list = set()
# 获取搜索推荐热词
results_registr_tag = RegisterShowTag.objects.filter(is_deleted=False, is_online=1).count()
results_tag = Tag.objects.filter(is_online=True, collection=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, offset, size)
results_tag = result_dict["hits"]["total"]
logging.info("get totoal:%s" % results_tag)
# 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