Loading TOC...


   $name as stringOrUDF[]
) as TuplesSearch


Applies one or more aggregates to the tuples. Exclusive with respect to the orderBy(), slice(), map(), and reduce() clauses. The built-in aggregates for tuples support only two indexes.

$name One or an array of built-in aggregate function names or aggregate user-defined function (UDF) reference. The allowed built-in aggregate names are "correlation", "covariance", and "covariancep". To construct UDF reference, use the jsearch.udf helper function.

Usage Notes

You can only use the TuplesSearch.where and TuplesSearch.withOptions clauses with this method. You cannot use other query modifiers such as TuplesSearch.slice or TuplesSearch.orderBy.

See Also


// Use the built-in "correlation" aggregate function.
const jsearch = require('/MarkLogic/jsearch.sjs');


// Compute a user-defined aggregate over co-occurrence of values in
// the "author" and "format" range indexes. The UDF is a function
// named "count" in the UDF plugin installed in the modules database
// with the path "native/sampleplugin".
const jsearch = require('/MarkLogic/jsearch.sjs');
jsearch.tuples(['author', 'format'])
  .aggregate(jsearch.udf('native/sampleplugin', 'count'))

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.