Loading TOC...

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 thesaurus function module is installed as the following file:

  • install_dir/Modules/MarkLogic/thesaurus.xqy

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

To use the thesaurus.xqy module in your own XQuery modules, include the following line in your XQuery prolog:

import module namespace thsr="http://marklogic.com/xdmp/thesaurus" at "/MarkLogic/thesaurus.xqy";

10 functions
Function name Description
thsr:add-synonym 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:query-lookup 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:remove-entry Removes all entries that exactly match $entry from the thesaurus documents(s) at $uri.
thsr:remove-synonym Removes synonym $synonym from thesaurus entry $entry.
thsr:remove-term Removes all entries with term $term from the thesaurus document(s) at $uri.
thsr:set-entry Adds the entry $entry to the thesaurus at $uri.