Commit 579a42a9 authored by lixiaofang's avatar lixiaofang

修改获取数据的大

parent eea2f48e
......@@ -63,17 +63,17 @@ def sync_face_similar_data_to_redis():
weight_score = int(item.similarity * 100)
item_list.append(
{
"filter":{
"constant_score":{
"filter":{
"term":{"user_id": item.contrast_user_id}
"filter": {
"constant_score": {
"filter": {
"term": {"user_id": item.contrast_user_id}
}
}
},
"weight": weight_score*2
"weight": weight_score * 2
}
)
if len(item_list)>=100:
if len(item_list) >= 100:
break
redis_client.set(redis_key, json.dumps(item_list))
......@@ -106,4 +106,3 @@ def sync_user_similar_score():
redis_client.set(redis_key, json.dumps(item_list))
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......@@ -33,10 +33,13 @@ 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_registr_tag = RegisterShowTag.objects.filter(is_deleted=False, is_online=1).count()
# 获取符合条件的核心词
results_tag = Tag.objects.filter(is_online=True, collection=1).count()
# results_tag = Tag.objects.filter(is_online=True, collection=1).count()
results_registr_tag = 25
results_tag = 10189849
tag_id = random.sample(range(1, results_registr_tag), 6)
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