MarkLogic Server 11.0 Product Documentation
clang.userLanguagePlugin

clang.userLanguagePlugin(
   library as String?,
   lexer as element(lang.lexer)?,
   stemmer as element(lang.stemmer)?,
   [delegate as Boolean?]
) as element(lang.plugin)

Summary

This function constructs a user language plugin configuration item, suitable for use with clang.userLanguage.

Parameters
library The name of the library containing the lexer and stemmer plugins (if they do not explictly specify a library). Use an empty string for built-in plugins. Use a library reference of the form plugin_path/plugin_id for user-defined plugins. Any library specified within the lexer or stemmer parameters takes precedence over this value.
lexer A lexer configuration item created using clang.lexer.
stemmer A stemmer configuration item created using clang.stemmer.
delegate Whether the stemmer should delegate automatically to the base stemmer. Default is true. For more details, see Understanding Stemming Delegation in the Search Developer's Guide.

Usage Notes

If you have previously installed a custom dictionary for this language, and you are changing the stemmer or lexer plugin to a different library, you will need to reinstall your dictionary. For example, you will need to call cdict.dictionaryWrite again.

If no library can be derived from either the library parameter of this function or the configuration of the supplied lexer or stemmer, an exception is raised when you try to use the lexer or stemmer. For example, if you omit library by setting it to an empty sequence (XQuery) or null (JavaScript)), and also pass in a lexer with no configured library, then an exception is raised when you try to use the lexer.

See Also

Example

// Create a plugin config item for a custom user-defined lexer and stemmer.
'use strict';
const clang = require('/MarkLogic/custom-language');

const lexer = clang.lexer('special_lexer','NFD');
const stemmer = clang.stemmer(
    'special_stemmer', 'NFC', Sequence.from(['keep-short-vowels=true']));
clang.userLanguagePlugin('native/special', lexer, stemmer);
    
Powered by MarkLogic Server | Terms of Use | Privacy Policy