|
|
thsr:expand(
|
|
$query as cts:query,
|
|
$entries as element(thsr:entry)*,
|
|
$new-weight as xs:double?,
|
|
$min-weight as xs:double?,
|
|
$filter as node()*
|
| ) as cts:query |
|
 |
Summary:
Returns a query that searches for all the query strings specified in $query
and their synonyms as found in $entries.
|
Parameters:
$query
:
A cts:query item from any of the
cts:*-query functions (cts:word-query,
cts:and-query, and so on). Thesaurus expansion only occurs
on an "unwildcarded" cts:query; it cannot expand "wildcarded"
queries.
|
$entries
:
A sequence of thesaurus entries.
|
$new-weight
:
A new weight for the relevance ranking. If $new-weight is the empty
sequence, then the relevance ranking is inherited from the parent query.
|
$min-weight
:
A minimum weight for the relevance ranking. If $min-weight is not the
empty sequence then only queries with weight less than or equal to
$min-weight will be expanded. Otherwise, all queiries are expanded.
|
$filter
:
A sequence of node restrictions. These restrictions must be nodes that
can be found in a thesaurus entry (for example,
<thsr:qualifier>birds</thsr:qualifier>).
|
|
Example:
xquery version "1.0-ml";
import module namespace
thsr="http://marklogic.com/xdmp/thesaurus"
at "/MarkLogic/thesaurus.xqy";
cts:search(
doc("/Docs/hamlet.xml")//LINE,
thsr:expand(
cts:word-query("weary"),
thsr:lookup("/myThsrDocs/thesaurus.xml",
"weary"),
(),
(),
() )
)
(: This query returns all of the lines in Shakespeare's
Hamlet that have the word "weary" or any of the
synonyms of the word "weary" :)
|
|
|