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
3899ebbf
Commit
3899ebbf
authored
Mar 17, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new tag3 cold start
parent
71e42e09
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
136 additions
and
0 deletions
+136
-0
new_tag3_cold_start.py
eda/smart_rank/new_tag3_cold_start.py
+136
-0
No files found.
eda/smart_rank/new_tag3_cold_start.py
0 → 100644
View file @
3899ebbf
import
json
import
redis
from
es_tool
import
es_query
keywords
=
[
"瘦脸"
,
"双眼皮"
,
"补水"
,
"美白嫩肤"
,
"瘦小腿"
,
"除皱"
,
"隆鼻"
,
"牙齿矫正"
,
"脱毛"
,
"祛斑"
,
"控油"
,
"面部祛脂"
,
"隆胸"
,
"垫鼻基底"
,
"缩鼻翼"
,
"生头发"
,
"开眼角"
,
"瘦肩"
,
"祛痘"
,
"缩毛孔"
,
"轮廓改善"
,
"除眼底细纹"
,
"眼部修复"
,
"垫下巴"
,
"颧骨内推"
,
"除法令纹"
,
"缩咬肌"
,
"瘦臀部"
,
"丰眼窝"
,
"瘦手臂"
,
"丰唇"
,
"瘦腰腹"
,
"瘦大腿"
,
"填充泪沟"
,
"洁面"
,
"除面部细纹"
,
"上眼睑提升"
,
"大眼睛"
,
"缩短眼距离"
,
"除印第安纹"
,
"瘦全身"
,
"下巴改善"
,
"祛双下巴"
,
"祛痘印"
,
"眼部护理"
,
"缩窄下巴"
,
"缩短下巴"
,
"填充苹果肌"
,
"祛痘坑"
,
"填充卧蚕"
]
def
get_es_diary
(
keywords
,
city_tag_id
=-
1
,
version
=
False
):
q
=
{}
sort_list
=
[{
"_script"
:
{
"lang"
:
"groovy"
,
"script_file"
:
"sort_diary-recommend"
,
"type"
:
"number"
,
"params"
:
{
"user_city_tag_id"
:
city_tag_id
,
},
"order"
:
"desc"
,
"_cache"
:
True
,
}
}]
if
version
:
sort_list
+=
[{
"has_video_cover"
:
{
"order"
:
"asc"
}
},
{
"offline_score_v1"
:
{
"order"
:
"desc"
}
},
{
"good_click"
:
{
"order"
:
"desc"
}
},
{
"last_update_time"
:
{
"order"
:
"desc"
}
}]
else
:
sort_list
+=
[{
"has_video_cover"
:
{
"order"
:
"asc"
}
},
{
"offline_score"
:
{
"order"
:
"desc"
}
},
{
"good_click"
:
{
"order"
:
"desc"
}
},
{
"last_update_time"
:
{
"order"
:
"desc"
}
}]
should_list
=
[{
"terms"
:
{
"first_demands"
:
keywords
}
},
{
"terms"
:
{
"second_demands"
:
keywords
}
},
{
"terms"
:
{
"first_solutions"
:
keywords
}
},
{
"terms"
:
{
"second_solutions"
:
keywords
}
},
{
"terms"
:
{
"positions"
:
keywords
}
},
{
"terms"
:
{
"second_positions"
:
keywords
}
},
{
"terms"
:
{
"tags_v3"
:
keywords
}
}]
q
[
"query"
]
=
{
"bool"
:
{
"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"
:
[
6
,
5
,
4
,
3.5
,
3
]
}
}],
"should"
:
should_list
,
"minimum_should_match"
:
1
}
}
q
[
"sort"
]
=
sort_list
q
[
"_source"
]
=
{
"includes"
:
[
"id"
,
"second_demands"
]}
es_res
=
es_query
(
"diary"
,
q
,
offset
=
0
,
size
=
500
)
diary_ids
=
[]
for
diary_info
in
es_res
[
"hits"
][
"hits"
]:
diary_ids
.
append
(
diary_info
[
"_source"
][
"id"
])
return
diary_ids
if
__name__
==
"__main__"
:
ids
=
get_es_diary
(
keywords
)
print
(
ids
)
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