Selaa lähdekoodia

HUE-2173 [search] Support limit in json terms facets

Romain Rigaux 10 vuotta sitten
vanhempi
commit
d48970ad8c

+ 1 - 1
apps/search/src/search/templates/search.mako

@@ -306,7 +306,7 @@ ${ dashboard.layout_skeleton() }
       <!-- /ko -->
     <!-- /ko -->
 
-    <!-- ko if: type() == 'field' -->
+    <!-- ko if: type() == 'field' || type() == 'terms' -->
       <div class="facet-field-cnt">
         <span class="spinedit-cnt">
           <span class="facet-field-label facet-field-label-fixed-width">

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

@@ -169,7 +169,9 @@ class SolrApi(object):
          
           json_facets['%(key)s' % props] = {
               'type': 'terms',
-              'field': facet['field']
+              'field': facet['field'],
+              'limit': int(facet['properties'].get('limit', 10)) + (1 if facet['widgetType'] == 'facet-widget' else 0),
+              'mincount': int(facet['properties']['mincount'])
           }
         elif facet['type'] == 'function':
           props = {