Loading TOC...

jsearch.udf

jsearch.udf(
   plugin as xs.string,
   aggregate as xs.string,
   argument as 
) as LexiconDefinition

Summary

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.

Parameters
plugin The name of the plugin providing the UDF. Required.
aggregate The name of the plugin function implementing the UDF. Required.
argument An optional additional argument passed with the values on the calls to the UDF.

See Also

Example


// 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();
   

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