clang.userLanguage( lang as String, plugin as element(lang.plugin), [tokenType as String] ) as element(lang.userLanguage)
This function constructs a user language configuration item, suitable for use with clang.updateUserLanguage.
Parameters | |
---|---|
lang | The language this configuration applies to. An ISO language code, such as "en". |
plugin | A language plugin configuration item constructed by clang.userLanguagePlugin. |
tokenType | The token type key for this language. Allowed values: one of the digit characters ('0','1',...,'9'). This only applies for languages that do not already have advanced support. Languages with advanced support already have a distinct token type that cannot be overridden. You should usually omit this parameter. |
tokenType
parameter is sometimes needed to distinguish
between multiple user-defined languages. This is an advanced feature
that is not required by most users. If you think you need to use this
capability and you have a current maintenance contract with
MarkLogic, please contact MarkLogic Technical Support.
'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'])); const plugin = clang.userLanguagePlugin('native/special', lexer, stemmer); clang.userLanguage('ca', plugin, '1');