MarkLogic 9 Product Documentation
thsr functions

The table below lists all the thsr built-in functions (in this namespace: http://marklogic.com/xdmp/thesaurus).

The thesaurus functions are designed to help you manage thesaurus documents and then use those thesaurus documents to lookup synonyms for words used in queries. Thesaurus documents are XML documents. The JavaScript API allows you to update existing thesaurus documents with a JSON representation of the thesaurus entries, so you do not have to specify XML. The load and insert functions do require XML, however. The thesaurus function module is installed as the following file:

where install_dir is the directory in which MarkLogic Server is installed.

To use the thesaurus module in your own Server-Side JavaScript modules, include the following line in your Javascript program:

var thsr = require("/MarkLogic/thesaurus");

10 functions
Function name Description
thsr.addSynonym Adds a synonym to the specified thesaurus entry.
thsr.expand Returns a query that searches for all the query strings specified in $query and their synonyms as found in $entries.
thsr.insert Load the entries in $thsr into the thesaurus at $uri.
thsr.load Load the file specified in $path to the thesaurus at $uri.
thsr.lookup Returns all entries for term $term in the thesaurus document(s) at $uri.
thsr.queryLookup Returns a Sequence of all entries that are found by looking up terms in the query and/or subqueries of $query in the thesaurus document(s) at $uri.
thsr.removeEntry Removes all entries that exactly match $entry from the thesaurus documents(s) at $uri.
thsr.removeSynonym Removes synonym $synonym from thesaurus entry $entry.
thsr.removeTerm Removes all entries with term $term from the thesaurus document(s) at $uri.
thsr.setEntry Adds the entry $entry to the thesaurus at $uri.
Powered by MarkLogic Server | Terms of Use | Privacy Policy