clang.updateUserLanguage

clang.updateUserLanguage(
   config as element(lang.userLanguages),
   user-lang as element(lang.userLanguage)
) as element(lang.userLanguages)

Summary

Add or replace a configuration item for a language in the given language configuration item, and return the new configuration.

Parameters
config A custom language configuration specification, typically as returned from one of the custom language module functions.
user-lang The configuration definition for a language, as constructed by clang.userLanguage.

See Also

Example

'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);
const catalanConfig = clang.userLanguage('ca', plugin);

// NOTE: Calling clang.languageConfigWrite causes a restart
clang.languageConfigWrite(
  clang.updateUserLanguage(
    clang.languageConfigRead(), catalanConfig));
    
Powered by MarkLogic Server | Terms of Use | Privacy Policy