Commit f1c48ef6 authored by lixiaofang's avatar lixiaofang

Merge branch 'highlight_topic' of git.wanmeizhensuo.com:alpha/physical into highlight_topic

parents bf786d54 908f59d6
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (physical1)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (LiXiaoFang)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
......
......@@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.6 (physical1)" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.6 (LiXiaoFang)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
......
......@@ -132,3 +132,26 @@ def get_tag_count():
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
def del_pictorial_read_ten_redis():
try:
now = datetime.datetime.now().date()
yes_time = now - datetime.timedelta(days=10)
logging.info("get yes_time:%s" % yes_time)
device_id = "123456"
redis_key = "physical:home_recommend_pictorial" + ":device_id:" + str(device_id)
logging.info("get redis:%s" % redis_key)
redis_question_val_list = redis_client.hgetall(redis_key)
logging.info("get redis_question_val_list:%s" % redis_question_val_list)
for item in redis_question_val_list:
items = item.encode(encoding='utf-8')
if items < str(yes_time):
redis_client.hdel(redis_key, item)
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......@@ -414,7 +414,9 @@ class ESPerform(object):
"include": ["id", "user_id"]
},
"sort": [
{"latest_reply_time": {"order": "desc"}},
{"_score": {"order": "desc"}},
{"latest_reply_time":{"order":"desc"}},
{"create_time_val": {"order": "desc"}},
{"language_type": {"order": "asc"}},
],
......
......@@ -159,7 +159,6 @@ class CollectData(object):
click_topic_tag_list = list()
if "on_click_feed_topic_card" == raw_val_dict["type"]:
topic_id = raw_val_dict["params"]["topic_id"]
device_id = raw_val_dict["device"]["device_id"]
user_id = raw_val_dict["user_id"] if "user_id" in raw_val_dict else None
......
......@@ -47,7 +47,8 @@ class GroupUtils(object):
return {"total_count": 0, "hits": []}
@classmethod
def get_hot_pictorial_recommend_result_list(cls, offset, size, es_cli_obj=None, attention_tag_list=[]):
def get_hot_pictorial_recommend_result_list(cls, offset, size, es_cli_obj=None, attention_tag_list=[],
have_read_pictorial_id_list=[]):
try:
if not es_cli_obj:
es_cli_obj = ESPerform.get_cli()
......@@ -92,7 +93,8 @@ class GroupUtils(object):
{"term": {"effective": True}}
],
"must_not": [
{"term": {"is_default": 1}}
{"term": {"is_default": 1}},
# {"terms": {"id": have_read_pictorial_id_list}}
]
}
},
......@@ -123,6 +125,10 @@ class GroupUtils(object):
"includes": ["id"]
}
if have_read_pictorial_id_list:
q["query"]["function_score"]["query"]["bool"]["must_not"].append(
{"terms": {"id": have_read_pictorial_id_list}})
result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", q, offset, size)
pictorial_ids_list = []
......
......@@ -738,10 +738,11 @@ class TopicUtils(object):
}
# "includes": ["id", "pictorial_id", "user_id", "_score", "create_time", "content_level"]
# q['sort'] = [
q['sort'] = [
{"latest_reply_time": {"order": "desc"}},
# {"content_level": {"order": "desc"}},
# {"create_time": {"order": "desc"}}
# ]
]
result_dict = ESPerform.get_search_results(es_cli_obj, sub_index_name=index_type, query_body=q, size=size,
routing=routing)
......@@ -1146,6 +1147,7 @@ class TopicUtils(object):
if sorts:
q["sort"] = sorts
logging.info("get --------qqqq:%s" % q)
result_dict = ESPerform.get_search_results(
ESPerform.get_cli(), sub_index_name=index_name,
query_body=q, offset=offset, size=size
......
This diff is collapsed.
......@@ -41,7 +41,7 @@ def search_hotword(device_id=-1):
for item in results_registr_tag:
for word in item.split():
tag_val_list.add(word)
tag_id_list = random.sample(range(0, len(tag_val_list)), 6)
tag_id_list = random.sample(range(0, len(tag_val_list)),1)
for tag_id in tag_id_list:
tag_val = list(tag_val_list)[tag_id]
all_tag_name_list.add(tag_val)
......
......@@ -19,6 +19,7 @@
"tag_list":{"type":"long"},//标签属性
"latest_reply_time":{"type":"date", "format":"date_time_no_millis"},
"useful_tag_list":{"type":"long"},//有用标签属性
"latest_reply_time":{"type":"date", "format":"date_time_no_millis"},
"edit_tag_list":{"type":"long"},//编辑标签
"tag_name_list":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"share_num":{"type":"long"},
......
......@@ -8,19 +8,19 @@
"vote_num":{"type":"long"},
"total_vote_num":{"type":"long"},
"reply_num":{"type":"long"},
"name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"description":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"content":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"name":{"type":"text","analyzer":"keyword","search_analyzer":"keyword"},
"description":{"type":"text","analyzer":"keyword","search_analyzer":"keyword"},
"content":{"type":"text","analyzer":"keyword","search_analyzer":"keyword"},
"content_level":{"type":"text"},
"user_id":{"type":"long"},
"user_nick_name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},//帖子用户名
"user_nick_name":{"type":"text","analyzer":"keyword","search_analyzer":"keyword"},//帖子用户名
"user_nick_name_pre": {"type":"text","analyzer":"keyword"}, //不切词的用户名
"group_id":{"type":"long"}, //所在组ID
"tag_list":{"type":"long"},//标签属性
"useful_tag_list":{"type":"long"},//有用标签属性
"latest_reply_time":{"type":"date", "format":"date_time_no_millis"},
"edit_tag_list":{"type":"long"},//编辑标签
"tag_name_list":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"tag_name_list":{"type":"text","analyzer":"keyword","search_analyzer":"keyword"},
"share_num":{"type":"long"},
"pick_id_list":{"type":"long"},
"offline_score":{"type":"double"},//离线算分
......@@ -45,14 +45,14 @@
"platform": {"type": "long"},
"platform_id": {"type": "long"},
"drop_score":{"type": "double"}, // 人工降分
"drop_score":{"type": "long"}, // 人工降分
"sort_score":{"type": "double"}, // 排序分
"pictorial_id":{"type": "long"}, //所在组ID
"pictorial_name":{ // 所在组名称
"type": "text",
"analyzer": "gm_default_index",
"search_analyzer": "gm_default_index"
"analyzer": "keyword",
"search_analyzer": "keyword"
},
"is_excellent":{"type": "long"},
"is_operation_home_recommend": {"type": "boolean"}, //是否首页运营推荐
......
......@@ -8,19 +8,20 @@
"vote_num":{"type":"long"},
"total_vote_num":{"type":"long"},
"reply_num":{"type":"long"},
"name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"description":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"content":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"name":{"type":"text","analyzer":"keyword","search_analyzer":"keyword"},
"description":{"type":"text","analyzer":"keyword","search_analyzer":"keyword"},
"content":{"type":"text","analyzer":"keyword","search_analyzer":"keyword"},
"content_level":{"type":"text"},
"user_id":{"type":"long"},
"user_nick_name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},//帖子用户名
"user_nick_name":{"type":"text","analyzer":"keyword","search_analyzer":"keyword"},//帖子用户名
"user_nick_name_pre": {"type":"text","analyzer":"keyword"}, //不切词的用户名
"group_id":{"type":"long"}, //所在组ID
"tag_list":{"type":"long"},//标签属性
"latest_reply_time":{"type":"date", "format":"date_time_no_millis"},
"useful_tag_list":{"type":"long"},//有用标签属性
"latest_reply_time":{"type":"date", "format":"date_time_no_millis"},
"edit_tag_list":{"type":"long"},//编辑标签
"tag_name_list":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"tag_name_list":{"type":"text","analyzer":"keyword","search_analyzer":"keyword"},
"share_num":{"type":"long"},
"pick_id_list":{"type":"long"},
"offline_score":{"type":"double"},//离线算分
......@@ -45,14 +46,14 @@
"platform": {"type": "long"},
"platform_id": {"type": "long"},
"drop_score":{"type": "double"}, // 人工降分
"drop_score":{"type": "long"}, // 人工降分
"sort_score":{"type": "double"}, // 排序分
"pictorial_id":{"type": "long"}, //所在组ID
"pictorial_name":{ // 所在组名称
"type": "text",
"analyzer": "gm_default_index",
"search_analyzer": "gm_default_index"
"analyzer": "keyword",
"search_analyzer": "keyword"
},
"is_excellent":{"type": "long"},
"is_operation_home_recommend": {"type": "boolean"}, //是否首页运营推荐
......
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