Commit 7dc38967 authored by lixiaofang's avatar lixiaofang

add

parent 0725fb40
......@@ -84,7 +84,7 @@ def pictorial_sort(user_id=-1, sort_type=GroupSortTypes.HOT_RECOMMEND, offset=0,
@bind("physical/search/pictorial_topic")
def pictorial_topic(topic_id=-1, offset=0, size=10):
"""
:remark 小组排序,缺少:前1天发评论人数*x
:remark 入选画报
:param user_id:
:param sort_type:
:param offset:
......@@ -103,19 +103,68 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
"term": {
"id": topic_id
}
}
q["_source"] = {
"include": ["id", "pictorial_id"]
"include": ["id", "pictorial_id", "tag_list"]
}
result_dict = ESPerform.get_search_results(es_cli_obj, "topic", q, offset, size)
pictorial_ids_list = []
topic_tag_list = []
if len(result_dict["hits"]) > 0:
pictorial_ids_list = [item["_source"]["id"] for item in result_dict["hits"]] #
topic_tag_list = [item["_source"]["tag_list"] for item in result_dict["hits"]] #
q["query"] = {
"terms": {
"id": pictorial_ids_list
}
}
q["_source"] = {
"include": ["id", "update_time"]
}
q["sort"] = {
'update_time': {
'order': 'desc'
}
}
result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", q, offset, size)
if len(result_dict["hits"]) > 0:
pictorial_id_list = [item["_source"]["id"] for item in result_dict["hits"]] #
pictorial_ids_list.append(pictorial_id_list)
if len(pictorial_ids_list) < 10:
q["query"] = {
"terms": {
"tag_id": topic_tag_list
}
}
q["_source"] = {
"include": ["id", "tag_id"]
}
q["sort"] = {
'update_time': {
'order': 'desc'
}
}
result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", q, offset, size)
if len(result_dict["hits"]) > 0:
pictorial_id_list = [item["_source"]["id"] for item in result_dict["hits"]] #
pictorial_ids_list.append(pictorial_id_list)
return {"pictorial_ids_list": pictorial_ids_list}
# if len(pictorial_ids_list) <10:
else:
return {"pictorial_ids_list":[]}
return {"pictorial_ids_list": pictorial_ids_list}
except:
......
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