Commit ac5effe0 authored by 段英荣's avatar 段英荣

modify

parent 7d405ea6
......@@ -36,7 +36,7 @@ def sync_face_similar_data_to_redis():
result_items = FaceUserContrastSimilar.objects.filter(is_online=True,is_deleted=False).distinct().values("participant_user_id").values_list("participant_user_id",flat=True)
logging.info("duan add,begin sync_face_similar_data_to_redis!")
redis_key_prefix = "physical:user_similar:participant_user_id:"
for participant_user_id in result_items:
......
......@@ -11,7 +11,7 @@ from libs.cache import redis_client
class PickUtils(object):
@classmethod
def refresh_redis_data(cls,have_read_celebrity_list,redis_cli,redis_key):
def refresh_redis_data(cls,have_read_celebrity_list,redis_cli,redis_key,if_expire=True):
try:
now = datetime.datetime.now()
......@@ -20,7 +20,10 @@ class PickUtils(object):
valid_seconds = int((end_time - now).seconds)
redis_cli.setex(redis_key,valid_seconds,json.dumps(have_read_celebrity_list))
if if_expire:
redis_cli.setex(redis_key,valid_seconds,json.dumps(have_read_celebrity_list))
else:
redis_cli.set(redis_key,json.dumps(have_read_celebrity_list))
return True
except:
......
......@@ -175,15 +175,15 @@ class TopicUtils(object):
}
}
},
"score_mode": "sum",
"boost_mode": "sum",
"score_mode": "max",
"boost_mode": "replace",
"functions": functions_list
}
if query is not None:#搜索帖子
multi_fields = {
'description': 2,
'name': 4,
'description': 200,
'name': 400,
}
query_fields = ['^'.join((k, str(v))) for (k, v) in multi_fields.items()]
multi_match = {
......
......@@ -116,7 +116,7 @@ def pick_topic(user_id,pick_id,offset=0,size=10):
if len(recommend_pick_topic_list)>0 and user_id!=-1:
total_read_topic_ids = have_read_pick_topic_ids + recommend_pick_topic_list
PickUtils.refresh_redis_data(have_read_celebrity_list=total_read_topic_ids,
redis_cli=redis_client,redis_key=redis_key)
redis_cli=redis_client,redis_key=redis_key,if_expire=False)
return {"recommend_pick_topic_ids": recommend_pick_topic_list}
......
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