Commit d8ededfe authored by litaolemo's avatar litaolemo

update

parent f8749c36
This diff is collapsed.
...@@ -187,7 +187,7 @@ def get_device_num_from_es(word): ...@@ -187,7 +187,7 @@ def get_device_num_from_es(word):
def get_tractate_tags_from_es(doc_id): def get_tractate_tags_from_es(doc_id):
print(doc_id) # print(doc_id)
body = { body = {
"query": { "query": {
"bool": { "bool": {
...@@ -204,7 +204,7 @@ def get_tractate_tags_from_es(doc_id): ...@@ -204,7 +204,7 @@ def get_tractate_tags_from_es(doc_id):
timeout='10s', timeout='10s',
body=body body=body
) )
print(results) # print(results)
return results["hits"]['hits'][0] return results["hits"]['hits'][0]
...@@ -342,11 +342,11 @@ def get_user_post_from_mysql(): ...@@ -342,11 +342,11 @@ def get_user_post_from_mysql():
second_demands_count_dict = {} second_demands_count_dict = {}
tags_v3_count_dict = {} tags_v3_count_dict = {}
sql = """ sql = """
select card_id from strategy_content_exposure_index where card_content_type="user_post" and preciseexposure_num>=50 and ctr>=0.05 and avg_page_stay>=20; select count(1) from strategy_content_exposure_index where card_content_type="user_post" and preciseexposure_num>=50 and ctr>=0.05 and avg_page_stay>=20 and create_day="2020-09-17";
""" """
sql_res = con_sql_doris_prod(sql) sql_res = con_sql_doris_prod(sql)
for card_id in sql_res: for card_id in sql_res:
print(card_id) # print(card_id)
es_res = get_tractate_tags_from_es(card_id[0]) es_res = get_tractate_tags_from_es(card_id[0])
for position in es_res["_source"]["second_demands"]: for position in es_res["_source"]["second_demands"]:
if position in second_demands_count_dict: if position in second_demands_count_dict:
......
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