
jsearch.udf( plugin as xs.string, aggregate as xs.string, argument as ) as LexiconDefinition
Identifies a UDF (User Defined Function)
to the ValuesSearch.aggregate function for aggregating
values from a single index or
to the TuplesSearch.aggregate function for aggregating
co-occurring values from multiple indexes. The native plugin
implementing the UDF must be installed on all hosts.
// Compute an aggregate using a UDF name "count", installed in
// in the modules database under native/sampleplugin
const jsearch = require('/MarkLogic/jsearch.sjs');
jsearch.values('price')
.aggregate(jsearch.udf('native/sampleplugin', 'count'))
.result();