MarkLogic Server
XQUERY API DOCUMENTATION
3.1
This page was generated
November  5,  2007
6:02  PM
XQuery Built-In and Modules Function Reference

Built-In: Search

The search built-in functions are XQuery functions used to perform text searches. The search functions are designed for use with XML structured text. Searches that use these functions use the indexes and are designed to return fast.

There are built-in functions to search through documents (cts:search, cts:contains and cts:highlight); there is a function to tokenize text into different types (cts:tokenize), and there are functions to retrieve result characteristics (for example cts:quality and cts:score). There are also built-in functions to browse word and value lexicons (cts:words, cts:element-values, and so on.) The lexicon built-in functions require the appropriate lexicons to be enabled in the Admin interface.

There are also functions to compose a cts:query, as well as accessor functions to retrieve the parameter values from a cts:query. These functions are documented in the cts:query Constructors section.

Function Summary
cts:confidence Returns the confidence of a node, or of the context node if no node is provided.
cts:contains Returns true if any of a sequence of nodes matches a query.
cts:deregister Deregister a registered query, explicitly releasing the associated resources.
cts:element-attribute-value-match Returns values from the specified element-attribute value lexicon(s) that match the specified wildcard pattern.
cts:element-attribute-values Returns values from the specified element-attribute value lexicon(s).
cts:element-attribute-word-match Returns words from the specified element-attribute word lexicon(s) that match a wildcard pattern.
cts:element-attribute-words Returns words from the specified element-attribute word lexicon(s).
cts:element-value-match Returns values from the specified element value lexicon(s) that match the specified wildcard pattern.
cts:element-values Returns values from the specified element value lexicon(s).
cts:element-word-match Returns words from the specified element word lexicon(s) that match a wildcard pattern.
cts:element-words Returns words from the specified element word lexicon.
cts:highlight Returns a copy of the node, replacing any text matching the query with the specified expression.
cts:quality Returns the quality of a node, or of the context node if no node is provided.
cts:register Register a query for later use.
cts:remainder Returns an estimated search result size for a node, or of the context node if no node is provided.
cts:score Returns the score of a node, or of the context node if no node is provided.
cts:search Returns a relevance-ordered sequence of nodes specified by a given query.
cts:tokenize Tokenizes text into words, punctuation, and spaces.
cts:word-match Returns words from the word lexicon that match the wildcard pattern.
cts:words Returns words from the word lexicon.
Function Detail
cts:confidence(
[$node as node()]
)  as   xs:float
Summary:

Returns the confidence of a node, or of the context node if no node is provided.

Parameters:
$node (optional): The node. Typically this is an item in the result sequence of a cts:search operation.

Usage Notes:

Confidence is similar to score, except that it is bounded. It is an xs:float in the range of 0.0 to 1.0. It does not include quality.

When using with any of the scoring methods, the confidence is calculated by first bounding the score in the range of 0.0 to 1.0, then taking the square root of that number.


Example:
  let $x := cts:search(collection(), "dog")
  return
  cts:confidence($x[1])

   => Returns the confidence value for the first item
      in the search.

cts:contains(
$nodes as node()*,
$query as cts:query
)  as   xs:boolean?
Summary:

Returns true if any of a sequence of nodes matches a query.

Parameters:
$nodes : The nodes to be checked for a match.
$query : The query to match against.

Example:
cts:contains(//PLAY
  [TITLE="The Tragedy of Hamlet, Prince of Denmark"]
      /ACT[3]/SCENE[1],
    cts:word-query("To be, or not to be"))
  => ..true, if ACT II, SCENE I of Hamlet contains
    the phrase "To be, or not to be" (it does).

cts:deregister(
$id as xs:unsignedLong
)  as   empty()
Summary:

Deregister a registered query, explicitly releasing the associated resources.

Parameters:
$id : The registered query identifier.

Example:
  cts:deregister(xs:unsignedLong("12345678901234567"))
  
   => ()

cts:element-attribute-value-match(
$element-names as xs:QName*,
$attribute-names as xs:QName*,
$pattern as xs:string,
[$options as xs:string*],
[$query as cts:query?]
)  as   xs:string*
Summary:

Returns values from the specified element-attribute value lexicon(s) that match the specified wildcard pattern. Element-attribute value lexicons are implemented using string range indexes; consequently this function requires an attribute range index of type xs:string for each of the element/attribute pairs specified in the function. If there is not a string range index configured for any of the specified element/attribute pairs, then an exception is thrown.

Parameters:
$element-names : The element QNames.
$attribute-names : The attribute QNames.
$pattern : Wildcard pattern to match.
$options (optional): Options. The default is ().

Options include:

"case-sensitive"
Specifies a case-sensitive match.
"case-insensitive"
Specifies a case-insensitive match.
"diacritic-sensitive"
Specifies a diacritic-sensitive match.
"diacritic-insensitive"
Specifies a diacritic-insensitive match.
"ascending"
Specifies that values should be returned in ascending order.
"descending"
Specifies that values should be returned in descending order.
"any"
Specifies that values in any fragment should be returned.
"document"
Specifies that values in document fragments should be returned.
"properties"
Specifies that values in properties fragments should be returned.
"locks"
Specifies that values in locks fragments should be returned.
$query (optional): Only return values that exist in fragments selected by the cts:query. That is, the values do not need to match the query, but they must occur in fragments that match the query.

Usage Notes:

If multiple element and/or attribute QNames are specified, then all possible element/attribute QName combinations are used to select the matching values.

Note the following interactions about the options:

If neither "case-sensitive" nor "case-insensitive" is present, $pattern is used to determine case sensitivity. If $pattern contains no uppercase, it specifies "case-insensitive". If $pattern contains uppercase, it specifies "case-sensitive".

If neither "diacritic-sensitive" nor "diacritic-insensitive" is present, $pattern is used to determine diacritic sensitivity. If $pattern contains no diacritics, it specifies "diacritic-insensitive". If $pattern contains diacritics, it specifies "diacritic-sensitive".

If the options parameter contains neither "ascending" nor "descending", then the default is "ascending".

At most one of "any", "document", "properties", or "locks" may be specified in the options parameter. If the options parameter contains none of "any", "document", "properties", or "locks", then the default is "any".

If the $query parameter is not present, and the current user is assigned the admin role, no value filtering is performed. Values may be returned that only appear in deleted fragments not yet expunged by a merge. To filter deleted values in this case, use a $query parameter. For example:

      cts:and-query( () ) 


Example:
  cts:element-attribute-value-match(xs:QName("animals"),
                     xs:QName("name"),"aardvark*")
  => ("aardvark","aardvarks")

cts:element-attribute-values(
$element-names as xs:QName*,
$attribute-names as xs:QName*,
[$start as xs:string],
[$options as xs:string*],
[$query as cts:query?]
)  as   xs:string*
Summary:

Returns values from the specified element-attribute value lexicon(s). Element-attribute value lexicons are implemented using string range indexes; consequently this function requires an attribute range index of type xs:string or xs:anyURI for each of the element/attribute pairs specified in the function. If there is not a string range index configured for any of the specified element/attribute pairs, then an exception is thrown. The values are returned in collation order.

Parameters:
$element-names : The element QNames.
$attribute-names : The attribute QNames.
$start (optional): A starting value. Return only this value and following values. If the empty string, return all values. If the parameter is not in the lexicon, then it returns the values beginning with the next value.
$options (optional): Options. The default is ().

Options include:

"ascending"
Specifies that values should be returned in ascending order.
"descending"
Specifies that values should be returned in descending order.
"any"
Specifies that values in any fragment should be returned.
"document"
Specifies that values in document fragments should be returned.
"properties"
Specifies that values in properties fragments should be returned.
"locks"
Specifies that values in locks fragments should be returned.
$query (optional): Only return values that exist in fragments selected by the cts:query. That is, the values do not need to match the query, but they must occur in fragments that match the query.

Usage Notes:

If multiple element and/or attribute QNames are specified, then all possible element/attribute QName combinations are used to select the matching values.

If the options parameter contains neither "ascending" nor "descending", then the default is "ascending".

At most one of "any", "document", "properties", or "locks" may be specified in the options parameter. If the options parameter contains none of "any", "document", "properties", or "locks", then the default is "any".

If the $query parameter is not present, and the current user is assigned the admin role, no value filtering is performed. Values may be returned that only appear in deleted fragments not yet expunged by a merge. O filter deleted values in this case, use a $query parameter. For example:

      cts:and-query( () ) 


Example:
  cts:element-attribute-values(xs:QName("animal"),
                               xs:QName("name"),
			       "aardvark")
  => ("aardvark","aardvarks","aardwolf",...)

cts:element-attribute-word-match(
$element-names as xs:QName*,
$attribute-names as xs:QName*,
$pattern as xs:string,
[$options as xs:string*],
[$query as cts:query?]
)  as   xs:string*
Summary:

Returns words from the specified element-attribute word lexicon(s) that match a wildcard pattern. This function requires an element-attribute word lexicon for each of the element/attribute pairs specified in the function. If there is not an element-attribute word lexicon configured for any of the specified element/attribute pairs, then an exception is thrown.

Parameters:
$element-names : The element QNames.
$attribute-names : The attribute QNames.
$pattern : Wildcard pattern to match.
$options (optional): Options. The default is ().

Options include:

"case-sensitive"
Specifies a case-sensitive match.
"case-insensitive"
Specifies a case-insensitive match.
"diacritic-sensitive"
Specifies a diacritic-sensitive match.
"diacritic-insensitive"
Specifies a diacritic-insensitive match.
"ascending"
Specifies that words should be returned in ascending order.
"descending"
Specifies that words should be returned in descending order.
"any"
Specifies that words in any fragment should be returned.
"document"
Specifies that words in document fragments should be returned.
"properties"
Specifies that words in properties fragments should be returned.
"locks"
Specifies that words in locks fragments should be returned.
$query (optional): Only return words that exist in fragments selected by the cts:query. That is, the words do not need to match the query, but the words must occur in fragments that match the query.

Usage Notes:

If multiple element and/or attribute QNames are specified, then all possible element/attribute QName combinations are used to select the matching values.

Note the following interactions about the options:

If neither "case-sensitive" nor "case-insensitive" is present, $pattern is used to determine case sensitivity. If $pattern contains no uppercase, it specifies "case-insensitive". If $pattern contains uppercase, it specifies "case-sensitive".

If neither "diacritic-sensitive" nor "diacritic-insensitive" is present, $pattern is used to determine diacritic sensitivity. If $pattern contains no diacritics, it specifies "diacritic-insensitive". If $pattern contains diacritics, it specifies "diacritic-sensitive".

If the options parameter contains neither "ascending" nor "descending", then the default is "ascending".

At most one of "any", "document", "properties", or "locks" may be specified in the options parameter. If the options parameter contains none of "any", "document", "properties", or "locks", then the default is "any".

If the $query parameter is not present, and the current user is assigned the admin role, no word filtering is performed. Words may be returned that only appear in deleted fragments not yet expunged by a merge. To filter deleted words in this case, use a $query parameter. For example:

      cts:and-query( () ) 


Example:
  cts:element-word-match(xs:QName("animals"),"aardvark*")
  => ("aardvark","aardvarks")

cts:element-attribute-words(
$element-names as xs:QName*,
$attribute-names as xs:QName*,
[$start as xs:string],
[$options as xs:string*],
[$query as cts:query?]
)  as   xs:string*
Summary:

Returns words from the specified element-attribute word lexicon(s). This function requires an element-attribute lexicon for each of the element/attribute pairs specified in the function. If there is not an element/attribute word lexicon configured for any of the specified element/attribute pairs, then an exception is thrown. The words are returned in collation order.

Parameters:
$element-names : The element QNames.
$attribute-names : The attribute QNames.
$start (optional): A starting word. Returns only this word and any following words from the lexicon. If this parameter is the empty string, it returns all of the words. If the parameter is not in the lexicon, then it returns the words beginning with the next word.
$options (optional): Options. The default is ().

Options include:

"ascending"
Specifies that words should be returned in ascending order.
"descending"
Specifies that words should be returned in descending order.
"any"
Specifies that words in any fragment should be returned.
"document"
Specifies that words in document fragments should be returned.
"properties"
Specifies that words in properties fragments should be returned.
"locks"
Specifies that words in locks fragments should be returned.
$query (optional): Only return words that exist in fragments selected by the cts:query. That is, the words do not need to match the query, but the words must occur in fragments that match the query.

Usage Notes:

If multiple element and/or attribute QNames are specified, then all possible element/attribute QName combinations are used to select the matching values.

If the options parameter contains neither "ascending" nor "descending", then the default is "ascending".

At most one of "any", "document", "properties", or "locks" may be specified in the options parameter. If the options parameter contains none of "any", "document", "properties", or "locks", then the default is "any".

If the $query parameter is not present, and the current user is assigned the admin role, no word filtering is performed. Words may be returned that only appear in deleted fragments not yet expunged by a merge. To filter deleted words in this case, use a $query parameter. For example:

      cts:and-query( () ) 


Example:
  cts:element-attribute-words(xs:QName("animal"),
                              xs:QName("name"),
			      "aardvark")
  => ("aardvark","aardvarks","aardwolf",...)

cts:element-value-match(
$element-names as xs:QName*,
$pattern as xs:string,
[$options as xs:string*],
[$query as cts:query?]
)  as   xs:string*
Summary:

Returns values from the specified element value lexicon(s) that match the specified wildcard pattern. Element value lexicons are implemented using string range indexes; consequently this function requires an element range index of type xs:string for each element specified in the function. If there is not a string range index configured for any of the specified elements, then an exception is thrown.

Parameters:
$element-names : The element QNames.
$pattern : Wildcard pattern to match.
$options (optional): Options. The default is ().

Options include:

"case-sensitive"
Specifies a case-sensitive match.
"case-insensitive"
Specifies a case-insensitive match.
"diacritic-sensitive"
Specifies a diacritic-sensitive match.
"diacritic-insensitive"
Specifies a diacritic-insensitive match.
"ascending"
Specifies that values should be returned in ascending order.
"descending"
Specifies that values should be returned in descending order.
"any"
Specifies that values in any fragment should be returned.
"document"
Specifies that values in document fragments should be returned.
"properties"
Specifies that values in properties fragments should be returned.
"locks"
Specifies that values in locks fragments should be returned.
$query (optional): Only return values that exist in fragments selected by the cts:query. That is, the values do not need to match the query, but they must occur in fragments that match the query.

Usage Notes:

Note the following interactions about the options:

If neither "case-sensitive" nor "case-insensitive" is present, $pattern is used to determine case sensitivity. If $pattern contains no uppercase, it specifies "case-insensitive". If $pattern contains uppercase, it specifies "case-sensitive".

If neither "diacritic-sensitive" nor "diacritic-insensitive" is present, $pattern is used to determine diacritic sensitivity. If $pattern contains no diacritics, it specifies "diacritic-insensitive". If $pattern contains diacritics, it specifies "diacritic-sensitive".

If the options parameter contains neither "ascending" nor "descending", then the default is "ascending".

At most one of "any", "document", "properties", or "locks" may be specified in the options parameter. If the options parameter contains none of "any", "document", "properties", or "locks", then the default is "any".

If the $query parameter is not present, and the current user is assigned the admin role, no value filtering is performed. Values may be returned that only appear in deleted fragments not yet expunged by a merge. To filter deleted values in this case, use a $query parameter. For example:

      cts:and-query( () ) 


Example:
  cts:element-value-match(xs:QName("animal"),"aardvark*")
  => ("aardvark","aardvarks")

cts:element-values(
$element-names as xs:QName*,
[$start as xs:string],
[$options as xs:string*],
[$query as cts:query?]
)  as   xs:string*
Summary:

Returns values from the specified element value lexicon(s). Element value lexicons are implemented using string range indexes; consequently this function requires an element index of type xs:string or xs:anyURI for each element specified in the function. If there is not a string range index configured for any of the specified elements, an exception is thrown. The values are returned in collation order.

Parameters:
$element-names : The element QNames.
$start (optional): A starting value. Return only this value and following values. If the empty string, return all values. If the parameter is is not in the lexicon, then it returns the values beginning with the next value.
$options (optional): Options. The default is ().

Options include:

"ascending"
Specifies that values should be returned in ascending order.
"descending"
Specifies that values should be returned in descending order.
"any"
Specifies that values in any fragment should be returned.
"document"
Specifies that values in document fragments should be returned.
"properties"
Specifies that values in properties fragments should be returned.
"locks"
Specifies that values in locks fragments should be returned.
$query (optional): Only return values that exist in fragments selected by the cts:query. That is, the values do not need to match the query, but they must occur in fragments that match the query.

Usage Notes:

If the options parameter contains neither "ascending" nor "descending", then the default is "ascending".

At most one of "any", "document", "properties", or "locks" may be specified in the options parameter. If the options parameter contains none of "any", "document", "properties", or "locks", then the default is "any".

If the $query parameter is not present, and the current user is assigned the admin role, no value filtering is performed. Values may be returned that only appear in deleted fragments not yet expunged by a merge. To filter deleted values in this case, use a $query parameter. For example:

      cts:and-query( () ) 


Example:
  cts:element-values(xs:QName("animal"),"aardvark")
  => ("aardvark","aardvarks","aardwolf",...)

cts:element-word-match(
$element-names as xs:QName*,
$pattern as xs:string,
[$options as xs:string*],
[$query as cts:query?]
)  as   xs:string*
Summary:

Returns words from the specified element word lexicon(s) that match a wildcard pattern. This function requires an element word lexicon configured for each of the specified elements in the function. If there is not an element word lexicon configured for any of the specified elements, an exception is thrown.

Parameters:
$element-names : The element QNames.
$pattern : Wildcard pattern to match.
$options (optional): Options. The default is ().

Options include:

"case-sensitive"
Specifies a case-sensitive match.
"case-insensitive"
Specifies a case-insensitive match.
"diacritic-sensitive"
Specifies a diacritic-sensitive match.
"diacritic-insensitive"
Specifies a diacritic-insensitive match.
"ascending"
Specifies that words should be returned in ascending order.
"descending"
Specifies that words should be returned in descending order.
"any"
Specifies that words in any fragment should be returned.
"document"
Specifies that words in document fragments should be returned.
"properties"
Specifies that words in properties fragments should be returned.
"locks"
Specifies that words in locks fragments should be returned.
$query (optional): Only return words that exist in fragments selected by the cts:query. That is, the words do not need to match the query, but the words must occur in fragments that match the query.

Usage Notes:

Note the following interactions about the options:

If neither "case-sensitive" nor "case-insensitive" is present, $pattern is used to determine case sensitivity. If $pattern contains no uppercase, it specifies "case-insensitive". If $pattern contains uppercase, it specifies "case-sensitive".

If neither "diacritic-sensitive" nor "diacritic-insensitive" is present, $pattern is used to determine diacritic sensitivity. If $pattern contains no diacritics, it specifies "diacritic-insensitive". If $pattern contains diacritics, it specifies "diacritic-sensitive".

If the options parameter contains neither "ascending" nor "descending", then the default is "ascending".

At most one of "any", "document", "properties", or "locks" may be specified in the options parameter. If the options parameter contains none of "any", "document", "properties", or "locks", then the default is "any".

If the $query parameter is not present, and the current user is assigned the admin role, no word filtering is performed. Words may be returned that only appear in deleted fragments not yet expunged by a merge. To filter deleted words in this case, use a $query parameter. For example:

      cts:and-query( () ) 

Only words that can be matched with element-word-query are returned. That is, only words present in immediate text node children of the specified element as well as any text node children of child elements defined in the Admin Interface as element-word-query-throughs or phrase-throughs.


Example:
  cts:element-word-match(xs:QName("animal"),"aardvark*")
  => ("aardvark","aardvarks")

cts:element-words(
$element-names as xs:QName*,
[$start as xs:string],
[$options as xs:string*],
[$query as cts:query?]
)  as   xs:string*
Summary:

Returns words from the specified element word lexicon. This function requires an element lexicon for each of the element specified in the function. If there is not an element word lexicon configured for any of the specified elements, an exception is thrown. The words are returned in collation order.

Parameters:
$element-names : The element QNames.
$start (optional): A starting word. Returns only this word and any following words from the lexicon. If this parameter is the empty string, it returns all of the words. If the parameter is not in the lexicon, then it returns the words beginning with the next word.
$options (optional): Options. The default is ().

Options include:

"ascending"
Specifies that words should be returned in ascending order.
"descending"
Specifies that words should be returned in descending order.
"any"
Specifies that words in any fragment should be returned.
"document"
Specifies that words in document fragments should be returned.
"properties"
Specifies that words in properties fragments should be returned.
"locks"
Specifies that words in locks fragments should be returned.
$query (optional): Only return words that exist in fragments selected by the cts:query. That is, the words do not need to match the query, but the words must occur in fragments that match the query.

Usage Notes:

If the options parameter contains neither "ascending" nor "descending", then the default is "ascending".

At most one of "any", "document", "properties", or "locks" may be specified in the options parameter. If the options parameter contains none of "any", "document", "properties", or "locks", then the default is "any".

If the $query parameter is not present, and the current user is assigned the admin role, no word filtering is performed. Words may be returned that only appear in deleted fragments not yet expunged by a merge. To filter deleted words in this case, use a $query parameter. For example:

      cts:and-query( () ) 

Only words that can be matched with element-word-query are returned. That is, only words present in immediate text node children of the specified element as well as any text node children of child elements defined in the Admin Interface as element-word-query-throughs or phrase-throughs.


Example:
  cts:element-words(xs:QName("animal"),"aardvark")
  => ("aardvark","aardvarks","aardwolf",...)

cts:highlight(
$node as node(),
$query as cts:query,
$expr as item()*
)  as   node()
Summary:

Returns a copy of the node, replacing any text matching the query with the specified expression. You can use this function to easily highlight any text found in a query. Unlike fn:replace and other XQuery string functions that match literal text, cts:highlight matches every term that matches the search, including stemmed matches or matches with different capitalization.

Parameters:
$node : The node to highlight. The node must be either a document node or an element node; it cannot be a text node.
$query : The query specifying the text to highlight.
$expr : The expression with which to replace each match. You can use the variables $cts:text, $cts:node, and $cts:queries (described below) in the expression.

Usage Notes:

There are three built-in variables to represent a query match. These variables can be used inline in the the expression parameter.

$cts:text as xs:string
the matched text
$cts:node as text()
the node containing the matched text
$cts:queries as cts:query*
the matching queries

You cannot use cts:highlight to highlight results from cts:similar-query and cts:element-attribute-*-query items. Using cts:highlight with these queries will return the nodes without any highlighting.

You can also use cts:highlight as a general search and replace function. The specified expression will replace any matching text. For example, you could replace the word "hello" with "goodbye" in a query similar to the following:

 cts:highlight($node, "hello", "goodbye")

Because the expressions can be any XQuery expression, they can be very simple like the above example or they can be extremely complex.


Example:
To highlight "MarkLogic" with bold in the following paragraph:
  
let $x :=  <p>MarkLogic Server is an enterprise-class 
  database specifically built for content.</p>
return 
cts:highlight($x, "MarkLogic", <b>{$cts:text}</b>)

Returns:
  
  <p><b>MarkLogic</b> Server is an enterprise-class 
  database specifically built for content.</p> 
  
Example:
Given the following document with the URI "hellogoodbye.xml":

<root>
  <a>It starts with hello and ends with goodbye.</a>
</root>

The following query will highlight the word "hello" in 
blue, and everything else in red.

cts:highlight(doc("hellogoodbye.xml"), 
       cts:and-query((cts:word-query("hello"),
                      cts:word-query("goodbye"))),
  if ( cts:word-query-text($cts:queries) eq "hello" )
  then ( <font color="blue">{$cts:text}</font> )
  else ( <font color="red">{$cts:text}</font> ) 
             )
	     
returns:

<root>
  <a>It starts with <font color="blue">hello</font> 
  and ends with <font color="red">goodbye</font>.</a>
</root>
Example:
for $x in cts:search(collection(), "MarkLogic")
return
cts:highlight($x, "MarkLogic", <b>{$cts:text}</b>)

returns all of the nodes that contain "MarkLogic", 
placing bold markup around the matched words.

cts:quality(
[$node as node()]
)  as   xs:integer
Summary:

Returns the quality of a node, or of the context node if no node is provided.

Parameters:
$node (optional): The node. Typically this is an item in the result sequence of a cts:search operation.

Usage Notes:

If you run cts:quality on a constructed node, it always returns 0; it is primarily intended to run on nodes that are the retrieved from the database (an item from a cts:search result or an item from the result of an XPath expression that searches through the database).


Example:
  xdmp:document-insert("/test.xml", <a>my test</a>, (), (), 50);
  for $x in cts:search(collection(),"my test")
  return cts:quality($x) => 50
Example:
  for $a in cts:search(collection(),"my test")
  where $a[cts:quality() gt 10]
  return base-uri($a) => /test.xml

cts:register(
$query as cts:query
)  as   xs:unsignedLong
Summary:

Register a query for later use.

Parameters:
$query : The query to register.

Example:
  cts:register(cts:collection-query("mycollection"))
  
  => 12345678901234567

cts:remainder(
[$node as node()]
)  as   xs:integer
Summary: