MarkLogic 9 Product Documentation
clang:lexer

clang:lexer(
   $variant as xs:string,
   [$normalization as xs:string?],
   [$args as item()*],
   [$library as xs:string]
) as element(lang:lexer)

Summary

This function constructs a custom lexer configuration item, suitable for use with clang:user-language-plugin.

Parameters
variant The name of the lexer plugin, either the name of one of the built-in lexers, or the name of a user-defined lexer capability. The latter should be the name of a LexerUDF capability registered by your plugin when MarkLogic calls Registry::registerLexer.
normalization The normalization that should be used to present text runs to the plugin lexer. Either "NFC" or "NFD". Default: NFC.
args A sequence of arguments that will be passed to the initialization of the plugin lexer as a sequence of strings.
library The name of the library containing variant. You should use an empty string when configuring a built-in plugin. If you omit this parameter, the library from the enclosing plugin configuration is used. See the Usage Notes for details.

Usage Notes

If you specify a library name in clang:lexer and when passing a lexer to clang:user-language-plugin then the value in the lexer takes precedence over the value in the plugin configuration.

For a built-in lexer, specify an empty string for the library name, or omit the library parameter and specify an empty string in clang:user-language-plugin.

For a user-defined plugin, the library name should be of the form plugin_path/plugin_id, such as "native/sample_plugin". If you omit this parameter, then the library value from clang:user-language-plugin will be used.

See Also

Example

(: Create a lexer config item from a user-defined plugin. :)
xquery version "1.0-ml";
import module namespace clang = "http://marklogic.com/xdmp/custom-language" 
    at "/MarkLogic/custom-language.xqy";

clang:lexer("special_lexer", "NFD", (), "native/sample_plugin")
  

Example

(: Create a lexer config item from a built-in plugin (atilika),
 : and pass in some configuration options. :)
xquery version "1.0-ml";
import module namespace clang = "http://marklogic.com/xdmp/custom-language" 
    at "/MarkLogic/custom-language.xqy";

clang:lexer("atilika", (), ("normal-mode"), "")
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy