Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
663be57f
Commit
663be57f
authored
Nov 11, 2019
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页feed新用户冷启动的日记、帖子、问答队列
parent
0b23d905
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
dist_update_user_history_order_tags.py
eda/smart_rank/dist_update_user_history_order_tags.py
+1
-1
gm_feed_cold_start.py
eda/smart_rank/gm_feed_cold_start.py
+10
-8
No files found.
eda/smart_rank/dist_update_user_history_order_tags.py
View file @
663be57f
...
...
@@ -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
)
...
...
eda/smart_rank/gm_feed_cold_start.py
View file @
663be57f
...
...
@@ -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
.
l
push
(
light_clinic_beauty_topic_queue_key
,
*
light_clinic_beauty_topic_queue
)
redis_client
.
r
push
(
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment