浏览代码

HUE-2173 [search] Apply proper ascending or descending sort

Romain Rigaux 9 年之前
父节点
当前提交
95412b3
共有 2 个文件被更改,包括 2 次插入4 次删除
  1. 0 3
      apps/search/src/search/models.py
  2. 2 1
      desktop/libs/libsolr/src/libsolr/api.py

+ 0 - 3
apps/search/src/search/models.py

@@ -845,9 +845,6 @@ def augment_solr_response(response, collection, query):
           dimension = 2
           counts = _augment_stats_2d(name, facet, counts, selected_values)
 
-        if collection_facet['properties']['sort'] == 'asc':
-          counts.reverse()
-
         facet = {
           'id': collection_facet['id'],
           'field': facet['field'],

+ 2 - 1
desktop/libs/libsolr/src/libsolr/api.py

@@ -336,7 +336,8 @@ class SolrApi(object):
           _f = {
               'field': facet['field'],
               'limit': int(facet['properties'].get('limit', 10)) + (1 if facet['widgetType'] == 'facet-widget' else 0),
-              'mincount': int(facet['properties']['mincount'])
+              'mincount': int(facet['properties']['mincount']),
+              'sort': {'count': facet['properties']['sort']}
           }
 
           if 'start' in facet['properties']: