Commit b69ccec7 authored by zhanglu's avatar zhanglu

Merge branch 'feature/sun_topic2es' into 'test'

Feature/sun topic2es

See merge request !189
parents b1d32416 394e5924
......@@ -584,6 +584,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":
......@@ -643,25 +646,26 @@ class TopicUtils(object):
})
elif isinstance(sorts_by, list):
if sorts_by == TOPIC_SEARCH_SORT.ID_ASC:
for sort_by in sorts_by:
if sort_by == TOPIC_SEARCH_SORT.ID_AEC:
sort_rule.append({
"id":{
"order":"asc"
},
})
elif sorts_by == TOPIC_SEARCH_SORT.ID_DESC:
elif sort_by == TOPIC_SEARCH_SORT.ID_DESC:
sort_rule.append({
"id":{
"order":"desc"
},
})
elif sorts_by == TOPIC_SEARCH_SORT.SCORE_AEC:
elif sort_by == TOPIC_SEARCH_SORT.SCORE_AEC:
sort_rule.append({
"sort_score":{
"order":"asc"
},
})
elif sorts_by == TOPIC_SEARCH_SORT.SCORE_DESC:
elif sort_by == TOPIC_SEARCH_SORT.SCORE_DESC:
sort_rule.append({
"sort_score":{
"order":"desc"
......@@ -685,6 +689,7 @@ class TopicUtils(object):
if sorts_by:
sorts = cls.process_sort(sorts_by)
if sorts:
q["sort"] = sorts
try:
......
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