Loading TOC...

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

  var 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"
        }
      ]
    })
  

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy