Commit 394e5924 authored by zhanglu's avatar zhanglu

fix

parent a8c37320
......@@ -561,6 +561,9 @@ class TopicUtils(object):
for k, v in filters.items():
if not v:
continue
if k in ["create_time_gte", "create_time_lte"]:
if k == "create_time_gte":
......@@ -620,30 +623,31 @@ class TopicUtils(object):
})
elif isinstance(sorts_by, list):
if sorts_by == TOPIC_SEARCH_SORT.ID_ASC:
sort_rule.append({
"id":{
"order":"asc"
},
})
elif sorts_by == TOPIC_SEARCH_SORT.ID_DESC:
sort_rule.append({
"id":{
"order":"desc"
},
})
elif sorts_by == TOPIC_SEARCH_SORT.SCORE_AEC:
sort_rule.append({
"sort_score":{
"order":"asc"
},
})
elif sorts_by == TOPIC_SEARCH_SORT.SCORE_DESC:
sort_rule.append({
"sort_score":{
"order":"desc"
},
})
for sort_by in sorts_by:
if sort_by == TOPIC_SEARCH_SORT.ID_AEC:
sort_rule.append({
"id":{
"order":"asc"
},
})
elif sort_by == TOPIC_SEARCH_SORT.ID_DESC:
sort_rule.append({
"id":{
"order":"desc"
},
})
elif sort_by == TOPIC_SEARCH_SORT.SCORE_AEC:
sort_rule.append({
"sort_score":{
"order":"asc"
},
})
elif sort_by == TOPIC_SEARCH_SORT.SCORE_DESC:
sort_rule.append({
"sort_score":{
"order":"desc"
},
})
return sort_rule
......@@ -662,7 +666,8 @@ class TopicUtils(object):
if sorts_by:
sorts = cls.process_sort(sorts_by)
q["sort"] = sorts
if sorts:
q["sort"] = sorts
try:
result_dict = ESPerform.get_search_results(
......
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