Commit 4dab11a7 authored by 段英荣's avatar 段英荣

Merge branch 'recommend_pictorial' into 'master'

Recommend pictorial

See merge request alpha/physical!461
parents 26a03a72 1e0c1a66
......@@ -139,7 +139,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
}
}
q["_source"] = {
"includes": ["id", "pictorial_id", "tag_list"]
"includes": ["id", "pictorial_id", "edit_tag_list"]
}
result_dict = ESPerform.get_search_results(es_cli_obj, "topic", q, offset, size)
pict_pictorial_ids_list = []
......@@ -148,7 +148,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
if len(result_dict["hits"]) > 0:
for item in result_dict["hits"]:
pict_pictorial_ids_list = item["_source"]["pictorial_id"]
topic_tag_list = item["_source"]["tag_list"]
topic_tag_list = item["_source"]["edit_tag_list"]
##拿到这些标签的同义词
......@@ -178,6 +178,11 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
"is_deleted": False
}
},
{
"term": {
"is_cover": True
}
}
]
}
......@@ -185,12 +190,18 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
q["_source"] = {
"includes": ["id", "update_time"]
}
q["sort"] = {
'update_time': {
q["sort"] = [
{
"real_user_activate_time": {
"order": "desc"
}
},
{'update_time': {
'order': 'desc'
}
}
}
]
result_dict = ESPerform.get_search_results(es_cli_obj, "pictorial", q, offset, size)
if len(result_dict["hits"]) > 0:
for item in result_dict["hits"]:
......@@ -208,7 +219,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
"bool": {
"must": [{
"terms": {
"tag_id": all_tag
"edit_tag_id": all_tag
}}, {
"term": {
"is_online": True
......@@ -224,6 +235,10 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
}
}
}, {
"term": {
"is_cover": True
}
}]
}
}
......@@ -233,7 +248,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
"constant_score": {
"filter": {
"terms": {
"tag_id": topic_tag_list
"edit_tag_id": topic_tag_list
}
}
}
......@@ -251,13 +266,18 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
}
}
q["_source"] = {
"includes": ["id", "tag_id"]}
"includes": ["id", "edit_tag_id"]}
q["sort"] = [
{
"_score": {
"order": "desc"
}
},
{
"real_user_activate_time": {
"order": "desc"
}
},
{
'update_time': {
'order': 'desc'
......
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