Commit 663be57f authored by 高雅喆's avatar 高雅喆

首页feed新用户冷启动的日记、帖子、问答队列

parent 0b23d905
......@@ -110,7 +110,7 @@ if __name__ == '__main__':
hot_search_words_portrait_dict = {i["keywords"]: 0.2 for i in hot_search_words}
redis_client.hmset(hot_search_words_portrait_portrait_key2, hot_search_words_portrait_dict)
hot_search_words = ["小气泡", "双眼皮", "水光针", "玻尿酸", "隆鼻", "牙齿矫正", "明星整形", "明星抗衰", "明星颜值", "明星婚恋", "网红整形", "网红抗衰", "网红颜值", "网红婚恋", "审美", "明星娱乐", "清洁补水"]
hot_search_words = ["小气泡", "双眼皮", "水光针", "玻尿酸", "隆鼻", "牙齿矫正", "明星整形", "明星抗衰", "明星颜值", "明星婚恋", "网红整形", "网红抗衰", "网红颜值", "网红婚恋", "审美"]
hot_search_words_portrait_portrait_key3 = "user:service_coldstart_tags3"
hot_search_words_portrait3_dict = {i: 0.2 for i in hot_search_words}
redis_client.hmset(hot_search_words_portrait_portrait_key3, hot_search_words_portrait3_dict)
......
......@@ -18,7 +18,7 @@ def search_diary_by_match_phrase(tag_names, city_tag_id):
else:
sort_list = [
{'_script': {
'lang': groovy,
'lang': 'groovy',
'script_file': 'sort_diary-recommend',
'type': 'number',
'params': {
......@@ -45,7 +45,7 @@ def search_diary_by_match_phrase(tag_names, city_tag_id):
}
total_query_should_list.append(term_dict)
q['query'] = {"bool": {
"filter": [{"term": {"is_online": True}}, {"terms": {"tags": tag_ids}},
"filter": [{"term": {"is_online": True}},
{"term": {"has_cover": True}}, {"term": {"is_sink": False}},
{"term": {"has_after_cover": True}}, {"term": {"has_before_cover": True}},
{"terms": {"content_level": [5, 4, 3.5, 3]}}],
......@@ -148,10 +148,10 @@ if __name__ == "__main__":
light_clinic_beauty_qa_queue_key = "coldstart:light:clinic:beauty:qa:queue"
light_clinic_beauty_diary_queue_key = "coldstart:light:clinic:beauty:diary:queue"
card_types = ['diary', 'topic', 'qa']
word_refers = ['hot_search_word', 'light_clinic_beauty']
word_refers = ['coldstart:hot:search:word', 'coldstart:light:clinic:beauty']
for card_type in card_types:
for word_refer in word_refers:
key = word_refer + '_' + card_type + '_queue_key'
key = word_refer + ':' + card_type + ':' + 'queue'
redis_client.delete(key)
# 热搜词的候选队列
......@@ -162,10 +162,12 @@ if __name__ == "__main__":
# 队列存储
hot_search_word_topic_queue = search_topic_by_match_phrase(hot_search_word)
redis_client.lpush(hot_search_word_topic_queue_key, *hot_search_word_topic_queue)
redis_client.rpush(hot_search_word_topic_queue_key, *hot_search_word_topic_queue)
redis_client.lrange(hot_search_word_topic_queue_key, 0, 3)
hot_search_word_qa_queue = search_qa_by_match_phrase(hot_search_word)
redis_client.lpush(hot_search_word_qa_queue_key, hot_search_word_qa_queue)
redis_client.rpush(hot_search_word_qa_queue_key, *hot_search_word_qa_queue)
redis_client.lrange(hot_search_word_qa_queue_key, 0, 3)
for city_tag_id in all_city_tag_id:
diary_queue = search_diary_by_match_phrase(hot_search_word, city_tag_id)
......@@ -180,10 +182,10 @@ if __name__ == "__main__":
# 队列存储
light_clinic_beauty_topic_queue = search_topic_by_match_phrase(light_clinic_beauty)
redis_client.lpush(light_clinic_beauty_topic_queue_key, *light_clinic_beauty_topic_queue)
redis_client.rpush(light_clinic_beauty_topic_queue_key, *light_clinic_beauty_topic_queue)
light_clinic_beauty_qa_queue = search_qa_by_match_phrase(light_clinic_beauty)
redis_client.lpush(light_clinic_beauty_qa_queue_key, light_clinic_beauty_qa_queue)
redis_client.rpush(light_clinic_beauty_qa_queue_key, *light_clinic_beauty_qa_queue)
for city_tag_id in all_city_tag_id:
diary_queue = search_diary_by_match_phrase(light_clinic_beauty, city_tag_id)
......
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