Loading TOC...

MarkLogic 10 Product Documentation
clang:user-language-plugin

clang:user-language-plugin(
   $library as xs:string?,
   $lexer as element(lang:lexer)?,
   $stemmer as element(lang:stemmer)?,
   [$delegate as xs:boolean?]
) as element(lang:plugin)

Summary

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

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:dictionary-write 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. :)
xquery version "1.0-ml";
import module namespace clang = "http://marklogic.com/xdmp/custom-language" 
  at "/MarkLogic/custom-language.xqy";

let $lexer := clang:lexer("special_lexer", "NFD")
let $stemmer := clang:stemmer("special_stemmer", "NFC", ("keep-short-vowels=true"))
return clang:user-language-plugin("native/special", $lexer, $stemmer)
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.