Loading TOC...

spell.insert

spell.insert(
   uri as String,
   dict as element(spell.dictionary) | Object | objectNode()
) as null

Summary

Load the words in $dict into the dictionary at $uri. If there is no document at $uri a new one will be created. If there is a document at $uri it will be overwritten.

Parameters
uri The URI of the dictionary.
dict A dictionary document which can be an xml element, a javascript object or a json object-node.

Example

  const spell = require("/MarkLogic/spell");
  declareUpdate();

  spell.insert("/mySpell/special.json", {"words":["WebDAV"]})

  => Creates a dictionary with only the word "WebDAV" 
     at the specified URI
  

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