User-Defined Function API 11.0
User-Defined Function API

Use this API to create user-defined functions (UDFs) callable from XQuery, Java, and RESTful MarkLogic Server applications. The API includes the following UDF interfaces:

  • AggregateUDF: Create a function to analyze range index values.
  • LexerUDF: Create a function to tokenize text runs.
  • StemmerUDF: Create a function stem individual words.

To deploy your UDF, package it as a MarkLogic Server native plugin library and install it using plugin:install-from-zip. When you install your plugin to one host in a MarkLogic Server cluster, it is automatically deployed to all hosts in the cluster.

NOTE: UDFs run in the same process space as the MarkLogic Server core. Errors and incompatibilities in your plugin can crash MarkLogic Server.

For more information on creating native plugins and user-defined functions, see "In-Database MapReduce Functions" in the Application Developer's Guide.

For a complete example of a native plugin that implements the AggregateUDF, LexerUDF, and StemmerUDF interfaces, see marklogic_dir/Samples/NativePlugin.