Commit 799ab6a8 authored by 高雅喆's avatar 高雅喆

用户冷启动增加新good click灰度实验

parent 86d9f289
......@@ -71,7 +71,7 @@ def search_diary_by_match_phrase(tag_names, city_tag_id, version):
return diary_ids
def search_topic_by_match_phrase(tag_names):
def search_topic_by_match_phrase(tag_names, version=0):
q = dict()
total_query_should_list = list()
for tag_name in tag_names:
......@@ -98,11 +98,17 @@ def search_topic_by_match_phrase(tag_names):
q["_source"] = {
"includes": ["id"]
}
q["sort"] = [
{"is_video": {"order": "asc"}},
{"tractate_score": {"order": "desc"}},
{"good_click": {"order": "desc"}}
]
if version:
q["sort"] = [
{"is_video": {"order": "asc"}},
{"tractate_score": {"order": "desc"}},
{"good_click": {"order": "desc"}}
]
else:
q["sort"] = [
{"is_video": {"order": "asc"}},
{"tractate_score": {"order": "desc"}}
]
es_res = es_query("tractate", q, offset=0, size=200)
topic_list = []
for topic_info in es_res['hits']['hits']:
......@@ -162,6 +168,7 @@ if __name__ == "__main__":
# hot_search_word_qa_queue_key = "coldstart:hot:search:word:qa:queue"
# hot_search_word_diary_queue_key = "coldstart:hot:search:word:diary:queue"
light_clinic_beauty_topic_queue_key = "coldstart:light:clinic:beauty:topic:queue"
light_clinic_beauty_topic_queue_grey_key = "coldstart:light:clinic:beauty:topic:queue:grey"
light_clinic_beauty_qa_queue_key = "coldstart:light:clinic:beauty:qa:queue"
light_clinic_beauty_qa_queue_grey_key = "coldstart:light:clinic:beauty:qa:queue:grey"
light_clinic_beauty_diary_queue_key = "coldstart:light:clinic:beauty:diary:queue"
......@@ -205,7 +212,9 @@ if __name__ == "__main__":
# 队列存储
light_clinic_beauty_topic_queue = search_topic_by_match_phrase(light_clinic_beauty)
light_clinic_beauty_topic_grey_queue = search_topic_by_match_phrase(light_clinic_beauty, version=1)
redis_client.rpush(light_clinic_beauty_topic_queue_key, *light_clinic_beauty_topic_queue)
redis_client.rpush(light_clinic_beauty_topic_queue_grey_key, *light_clinic_beauty_topic_grey_queue)
print("轻医美词更新的帖子队列长度:%s" % str(len(light_clinic_beauty_topic_queue)))
light_clinic_beauty_qa_queue = search_qa_by_match_phrase(light_clinic_beauty)
......
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