Loading TOC...

MarkLogic Server 11.0 Product Documentation
thsr.setEntry

thsr.setEntry(
   uri as String,
   entry as element(thsr.entry)|Object
) as null

Summary

Adds the entry $entry to the thesaurus at $uri.

Parameters
uri The URI of a thesaurus document.
entry An entry to add to the thesaurus, can either be an xml element or javascript object.

Usage Notes

set the entry $entry in the thesaurus at $uri. If $entry does not contain a valid entry node, an error will be raised. If an entry matching $entry does not exist in the thesaurus, $entry is added to the thesaurus. If $entry contains XML that does not conform to the thesaurus schema (located in install_dir/Config/thesaurus.xsd), an error is raised.

Example

  const thsr = require("/MarkLogic/thesaurus");
  declareUpdate();

  thsr.setEntry("/myThsrDocs/roget.xml", 
    { 
      "term":"Car",
      "synonyms":[
        {"term":"Ford",
         "partOfSpeech":"noun"
        },
        {"term":"automobile",
         "partOfSpeech":"noun"
        },
        {"term":"Fiat",
         "partOfSpeech":"noun"
        }
      ]
    })
  

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