Commit 230e12fb authored by lixiaofang's avatar lixiaofang

add

parent 4a82d669
...@@ -929,6 +929,7 @@ class TopicUtils(object): ...@@ -929,6 +929,7 @@ class TopicUtils(object):
}, },
}) })
elif sort_by == TOPIC_SEARCH_SORT.REAL_VOTE_AEC: elif sort_by == TOPIC_SEARCH_SORT.REAL_VOTE_AEC:
logging.info("hhhhhhhhhhhhhhhhhhhhh")
sort_rule.append({ sort_rule.append({
"related_billboard.real_vote_cnt": { "related_billboard.real_vote_cnt": {
"order": "asc", "order": "asc",
...@@ -943,11 +944,13 @@ class TopicUtils(object): ...@@ -943,11 +944,13 @@ class TopicUtils(object):
}, },
}) })
elif sort_by == TOPIC_SEARCH_SORT.REAL_VOTE_DESC: elif sort_by == TOPIC_SEARCH_SORT.REAL_VOTE_DESC:
logging.info("hhhhhhhhhh3333hhhhhhhhhhh")
sort_rule.append({ sort_rule.append({
"related_billboard.real_vote_cnt": { "related_billboard.real_vote_cnt": {
"order": "desc", "order": "desc",
"nested_path": "related_billboard", "nested_path": "related_billboard",
"missing": "_last", # "missing": "_last",
"nested_filter": { "nested_filter": {
"term": { "term": {
"related_billboard.pictorial_id": pictorial_id "related_billboard.pictorial_id": pictorial_id
...@@ -957,11 +960,13 @@ class TopicUtils(object): ...@@ -957,11 +960,13 @@ class TopicUtils(object):
}, },
}) })
elif sort_by == TOPIC_SEARCH_SORT.VIRT_VOTE_AEC: elif sort_by == TOPIC_SEARCH_SORT.VIRT_VOTE_AEC:
logging.info("hhhhhhhhhhghfhgdggerrhhhhhhhhhhh")
sort_rule.append({ sort_rule.append({
"related_billboard.virt_vote_cnt": { "related_billboard.virt_vote_cnt": {
"order": "asc", "order": "asc",
"nested_path": "related_billboard", "nested_path": "related_billboard",
"missing": "_last", # "missing": "_last",
"nested_filter": { "nested_filter": {
"term": { "term": {
"related_billboard.pictorial_id": pictorial_id "related_billboard.pictorial_id": pictorial_id
...@@ -970,11 +975,13 @@ class TopicUtils(object): ...@@ -970,11 +975,13 @@ class TopicUtils(object):
}, },
}) })
elif sort_by == TOPIC_SEARCH_SORT.VIRT_VOTE_DESC: elif sort_by == TOPIC_SEARCH_SORT.VIRT_VOTE_DESC:
logging.info("hhhhhhhhhhhhheeeeeeehhhhhhhh")
sort_rule.append({ sort_rule.append({
"related_billboard.virt_vote_cnt": { "related_billboard.virt_vote_cnt": {
"order": "desc", "order": "desc",
"nested_path": "related_billboard", "nested_path": "related_billboard",
"missing": "_last", # "missing": "_last",
"nested_filter": { "nested_filter": {
"term": { "term": {
"related_billboard.pictorial_id": pictorial_id "related_billboard.pictorial_id": pictorial_id
...@@ -982,6 +989,8 @@ class TopicUtils(object): ...@@ -982,6 +989,8 @@ class TopicUtils(object):
} }
}, },
}) })
logging.info("get picotirial:%s" % sort_rule)
return sort_rule return sort_rule
@classmethod @classmethod
...@@ -1040,13 +1049,15 @@ class TopicUtils(object): ...@@ -1040,13 +1049,15 @@ class TopicUtils(object):
} }
if 'pictorial_id' in filters.keys(): if 'pictorial_id' in filters.keys():
logging.info("get picotirial:%s" % filters["pictorial_id"]) logging.info("get picotirial:%s" % filters["pictorial_id"])
logging.info("get picotirial:%s" % sorts_by)
if sorts_by: if sorts_by:
sorts = cls.process_sort(sorts_by, filters["pictorial_id"]) sorts = cls.process_sort(sorts_by, filters["pictorial_id"])
if sorts: if sorts:
q["sort"] = sorts q["sort"] = sorts
else: else:
if sorts_by: if sorts_by:
sorts = cls.process_sort(sorts_by,pictorial_id=None) sorts = cls.process_sort(sorts_by, pictorial_id=None)
if sorts: if sorts:
q["sort"] = sorts q["sort"] = sorts
......
...@@ -277,8 +277,13 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10): ...@@ -277,8 +277,13 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10):
"sort": [ "sort": [
{"related_billboard.total_vote_cnt": { {"related_billboard.total_vote_cnt": {
"order": "desc", "order": "desc",
# "mode": "min", "nested_path": "related_billboard",
"nested_path": "related_billboard" "missing": "_last",
"nested_filter": {
"term": {
"related_billboard.pictorial_id": pictorial_id
}
}
}}, }},
{"create_time": {"order": "desc"}} {"create_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