Commit 821090cd authored by 段英荣's avatar 段英荣

modify

parent c8615822
......@@ -344,9 +344,6 @@ class TopicUtils(object):
pick_user_info_list = result_dict["hits"][0]["_source"]["pick_user_id_list"]
pick_user_id_list = [item["user_id"] for item in pick_user_info_list]
q = dict()
q["query"] = dict()
functions_list = [
{
"gauss": {
......@@ -391,9 +388,12 @@ class TopicUtils(object):
"functions": functions_list
}
q["query"]["function_score"] = query_function_score
q = dict()
q["query"] = {
"function_score":query_function_score
}
q["_source"] = {
"include":["id","group_id","user_id","_score"]
"include":["id","group_id","user_id","_score","offline_score","manual_score"]
}
q["sort"] = [
{
......@@ -401,8 +401,9 @@ class TopicUtils(object):
"type":"number",
"script":{
"lang":"painless",
"source":"_score"
}
"source":"_score+params._source.offline_score+params._source.manual_score"
},
"order":"desc"
}
}
]
......@@ -410,8 +411,7 @@ class TopicUtils(object):
result_dict = ESPerform.get_search_results(ESPerform.get_cli(), sub_index_name="topic", query_body=q,
offset=offset, size=size)
return list()
return result_dict["hits"]
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return list()
\ No newline at end of file
......@@ -168,7 +168,7 @@ def topic_detail_page_recommend(user_id=-1,topic_id=-1,topic_group_id=-1,topic_u
@bind("physical/search/tag_aggregation")
def tag_aggregation(tag_id, offset, size):
def tag_aggregation(user_id,tag_id, offset, size):
"""
:remark 按标签聚合召回帖子
:param tag_id:
......@@ -177,7 +177,12 @@ def tag_aggregation(tag_id, offset, size):
:return:
"""
try:
return {"recommend_topic_id": []}
result_list = TopicUtils.get_tag_aggregation_topic_id_list(user_id,tag_id,offset,size)
recommend_topic_ids_list = list()
if len(result_list)>0:
recommend_topic_ids_list = [item["_source"]["id"] for item in result_list]
return {"recommend_topic_id": recommend_topic_ids_list}
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return {"recommend_topic_id": []}
......
......@@ -17,6 +17,7 @@
"share_num":{"type":"long"},
"pick_id_list":{"type":"long"},
"offline_score":{"type":"double"},//离线算分
"manual_score":{"type":"double"},//人工赋分
"create_time":{"type":"date", "format":"date_time_no_millis"},
"update_time":{"type":"date", "format":"date_time_no_millis"},
"create_time_val":{"type":"long"},
......
......@@ -39,6 +39,7 @@ class Topic(models.Model):
group = models.ForeignKey(
Group, verbose_name=u"关联的小组", related_name=u"group_topics",null=True, blank=True, default=None, on_delete=models.CASCADE)
user_id = models.IntegerField(verbose_name='用户ID')
drop_score = models.IntegerField(verbose_name=u'人工赋分')
description = models.CharField(verbose_name='日记本描述',max_length=200)
content = models.CharField(verbose_name='日记本内容',max_length=1000)
share_num = models.IntegerField(verbose_name='')
......
......@@ -36,6 +36,7 @@ class TopicTransfer(object):
res["tag_name_list"] = instance.get_tag_name_list(res["tag_list"])
res["offline_score"] = instance.get_topic_offline_score()
res["manual_score"] = instance.drop_score
create_time = instance.create_time
tzlc_create_time = tzlc(create_time)
......
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