lib/query-builder.js
function calculate() {
  /*jshint validthis:true */
  var self = (this instanceof QueryBuilder) ? this : new QueryBuilder();

  var args = mlutil.asArray.apply(null, arguments);

  // TODO: distinguish facets and values
  var calculateClause = {
      constraint: args
  };

  self.calculateClause = calculateClause;

  return self;
}
function calculate() {
  /*jshint validthis:true */
  var self = (this instanceof QueryBuilder) ? this : new QueryBuilder();

  var args = mlutil.asArray.apply(null, arguments);

  // TODO: distinguish facets and values
  var calculateClause = {
      constraint: args
  };

  self.calculateClause = calculateClause;

  return self;
}
function calculate ( ) { /*jshint validthis:true */ var self = ( this instanceof QueryBuilder ) ? this : new QueryBuilder ( ) ; var args = mlutil . asArray . apply ( null , arguments ) ; // TODO: distinguish facets and values var calculateClause = { constraint : args } ; self . calculateClause = calculateClause ; return self ; }
Sets the calculate clause of a built query, specifying JSON properties,
XML elements or attributes, fields, or paths with a range index for
value frequency or other aggregate calculation.
@method
@since 1.0
@memberof queryBuilder#
@param {queryBuilder.Facet} ...facets - the facets to calculate
over the documents in the result set as returned by
the {@link queryBuilder#facet} function.
@returns {queryBuilder.BuiltQuery} a built query
Sets the calculate clause of a built query specifying JSON properties XML elements or attributes fields or paths with a range index for value frequency or other aggregate calculation .