Эх сурвалжийг харах

HUE-3294 [search] Support multiplication in aggregate functions

Romain Rigaux 9 жил өмнө
parent
commit
b29b996

+ 2 - 6
apps/search/src/search/templates/common_search.mako

@@ -1992,11 +1992,7 @@ ${ dashboard.layout_skeleton() }
     <!-- /ko -->
     
     <!-- ko if: $data.function() == 'field' -->
-      <select data-bind="selectize: $root.collection.template.fieldsNames, options: $root.collection.template.fieldsNames, value: value, optionsCaption: '${ _ko('Field...') }'" class="hit-options" style="margin-bottom: 0"></select>
-    <!-- /ko -->
-
-    <!-- ko if: $data.function() == 'constant' -->
-      <input data-bind="value: value" class="hit-options" style="margin-bottom: 0"></select>
+      <select data-bind="selectize: $root.collection.template.fieldsNames, options: $root.collection.template.fieldsNames, value: value, selectizeOptions: {create: true}, optionsCaption: '${ _ko('Field...') }'" class="hit-options" style="margin-bottom: 0"></select>
     <!-- /ko -->
 
     <a href="javascript: void(0)" data-bind="click: function() {
@@ -2007,7 +2003,7 @@ ${ dashboard.layout_skeleton() }
 
     <br/>
     <a href="javascript: void(0)" data-bind="click: function() {
-        $data.ops.push(ko.mapping.fromJS({'function': 'mul', 'ops': [{'function': 'field', 'value': 'price', 'ops': []}, {'function': 'constant', 'value': '2', 'ops': []}]})); }
+        $data.ops.push(ko.mapping.fromJS({'function': 'mul', 'ops': [{'function': 'field', 'value': 'price', 'ops': []}, {'function': 'field', 'value': '2', 'ops': []}]})); }
       ">
       <i class="fa fa-plus" title="${ _('Add formula operation') }"></i>
     </a>

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

@@ -607,12 +607,12 @@ class SolrApi(object):
     f = facet['properties']['aggregate']
     
     if not f['ops']:
-      f['ops'] = [{u'function': u'field', 'value': facet['field'], u'ops': []}]
+      f['ops'] = [{'function': 'field', 'value': facet['field'], 'ops': []}]
     
     return self.__get_aggregate_function(f)
 
   def __get_aggregate_function(self, f):
-    if f['function'] == 'field' or f['function'] == 'constant':
+    if f['function'] == 'field':
       return f['value']
     else:
       fields = []