Commit 579a42a9 authored by lixiaofang's avatar lixiaofang

修改获取数据的大

parent eea2f48e
...@@ -63,17 +63,17 @@ def sync_face_similar_data_to_redis(): ...@@ -63,17 +63,17 @@ def sync_face_similar_data_to_redis():
weight_score = int(item.similarity * 100) weight_score = int(item.similarity * 100)
item_list.append( item_list.append(
{ {
"filter":{ "filter": {
"constant_score":{ "constant_score": {
"filter":{ "filter": {
"term":{"user_id": item.contrast_user_id} "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 break
redis_client.set(redis_key, json.dumps(item_list)) redis_client.set(redis_key, json.dumps(item_list))
...@@ -106,4 +106,3 @@ def sync_user_similar_score(): ...@@ -106,4 +106,3 @@ def sync_user_similar_score():
redis_client.set(redis_key, json.dumps(item_list)) redis_client.set(redis_key, json.dumps(item_list))
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
...@@ -33,10 +33,13 @@ def search_hotword(device_id=-1): ...@@ -33,10 +33,13 @@ def search_hotword(device_id=-1):
try: try:
all_tag_name_list = set() 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) 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) results_tag_chose = Tag.objects.filter(id__in=tag_id).values_list("name", flat=True)
for i in results_tag_chose: 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