MarkLogic Server
XQUERY API DOCUMENTATION
3.2
This page was generated
January 5, 2009
5:42 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:collection-match Returns values from the collection lexicon that match the specified wildcard pattern.
cts:collections Returns values from the collection lexicon.
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:field-word-match Returns words from the specified field word lexicon(s) that match a wildcard pattern.
cts:field-words Returns words from the specified field word lexicon.
cts:fitness Returns the fitness of a node, or of the context node if no node is provided.
cts:frequency Returns an integer representing the number of times in which a particular value occurs in a value lexicon lookup (for example, cts:element-values).
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:stem Stems a word.
cts:tokenize Tokenizes text into words, punctuation, and spaces.
cts:uri-match Returns values from the URI lexicon that match the specified wildcard pattern.
cts:uris Returns values from the URI lexicon.
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:collection-match(
$pattern as xs:string,
[$options as xs:string*],
[$query as cts:query?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  xs:string*
Summary:

Returns values from the collection lexicon that match the specified wildcard pattern. This function requires the collection-lexicon database configuration parameter to be enabled. If the uri-lexicon database-configuration parameter is not enabled, an exception is thrown.

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

Options include:

"case-sensitive"
A case-sensitive match.
"case-insensitive"
A case-insensitive match.
"diacritic-sensitive"
A diacritic-sensitive match.
"diacritic-insensitive"
A diacritic-insensitive match.
"ascending"
URIs should be returned in ascending order.
"descending"
URIs should be returned in descending order.
"any"
URIs from any fragment should be included.
"document"
URIs from document fragments should be included.
"properties"
URIs from properties fragments should be included.
"locks"
URIs from locks fragments should be included.
"frequency-order"
URIs should be returned ordered by frequency.
"item-order"
URIs should be returned ordered by collation.
"truncate=N"
Include URIs only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include URIs from fragments selected by the cts:query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "frequency-order" or "item-order" may be specified in the options parameter. If neither "frequency-order" nor "item-order" is specified, then the default is "item-order".

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending" if "item-order" is specified, and "descending" if "frequency-order" is specified.

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "truncate=N" is not specfied in the options parameter, then URIs from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

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 $query parameter is not present and the current user is assigned the admin role, URIs from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see URIs from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      cts:and-query( () ) 


Example:
  cts:collection-match("collection*")
  => ("collection1", "collection2", ...)

cts:collections(
[$start as xs:string],
[$options as xs:string*],
[$query as cts:query?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  xs:string*
Summary:

Returns values from the collection lexicon. This function requires the collection-lexicon database configuration parameter to be enabled. If the collection-lexicon database-configuration parameter is not enabled, an exception is thrown.

Parameters:
$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"
URIs should be returned in ascending order.
"descending"
URIs should be returned in descending order.
"any"
URIs from any fragment should be included.
"document"
URIs from document fragments should be included.
"properties"
URIs from properties fragments should be included.
"locks"
URIs from locks fragments should be included.
"frequency-order"
URIs should be returned ordered by frequency.
"item-order"
URIs should be returned ordered by collation.
"truncate=N"
Include URIs only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include URIs from fragments selected by the cts:query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "frequency-order" or "item-order" may be specified in the options parameter. If neither "frequency-order" nor "item-order" is specified, then the default is "item-order".

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending" if "item-order" is specified, and "descending" if "frequency-order" is specified.

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "truncate=N" is not specfied in the options parameter, then words from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

If the $query parameter is not present and the current user is assigned the admin role, URIs from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see URIs from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      cts:and-query( () ) 


Example:
  cts:collections("aardvark")
  => ("aardvark", "aardvarks", ...)

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): A 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 similar to fitness, except that it is influenced by term IDFs. 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 : Some nodes to be checked for a match.
$query : A 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 : A 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?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  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 : One or more element QNames.
$attribute-names : One or more attribute QNames.
$pattern : Wildcard pattern to match. The pattern is matched according to the collation of the range index used to resolve the query.
$options (optional): Options. The default is ().

Options include:

"case-sensitive"
A case-sensitive match.
"case-insensitive"
A case-insensitive match.
"diacritic-sensitive"
A diacritic-sensitive match.
"diacritic-insensitive"
A diacritic-insensitive match.
"ascending"
Values should be returned in ascending order.
"descending"
Values should be returned in descending order.
"any"
Values from any fragment should be included.
"document"
Values from document fragments should be included.
"properties"
Values from properties fragments should be included.
"locks"
Values from locks fragments should be included.
"frequency-order"
Values should be returned ordered by frequency.
"item-order"
"fragment-frequency"
Frequency should be the number of fragments with an included value. This option is used with cts:frequency.
"item-frequency"
Frequency should be the number of occurences of an included value. This option is used with cts:frequency.
Values should be returned ordered by collation.
"collation=URI"
Use the range index with the collation specified by URI.
"truncate=N"
Include values only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include values in fragments selected by the cts:query. The values do not need to match the query, but they must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "frequency-order" or "item-order" may be specified in the options parameter. If neither "frequency-order" nor "item-order" is specified, then the default is "item-order".

Only one of "fragment-frequency" or "item-frequency" may be specified in the options parameter. If neither "fragment-frequency" nor "item-frequency" is specified, then the default is "fragment-frequency".

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending" if "item-order" is specified, and "descending" if "frequency-order" is specified.

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a range index with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then values from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

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".

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

If the $query parameter is not present and the current user is assigned the admin role, values from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see values from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      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?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  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 : One or more element QNames.
$attribute-names : One or more 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"
Values should be returned in ascending order.
"descending"
Values should be returned in descending order.
"any"
Values from any fragment should be included.
"document"
Values from document fragments should be included.
"properties"
Values from properties fragments should be included.
"locks"
Values from locks fragments should be included.
"frequency-order"
Values should be returned ordered by frequency.
"item-order"
"fragment-frequency"
Frequency should be the number of fragments with an included value. This option is used with cts:frequency.
"item-frequency"
Frequency should be the number of occurences of an included value. This option is used with cts:frequency.
"collation=URI"
Use the range index with the collation specified by URI.
"truncate=N"
Include values only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include values in fragments selected by the cts:query. The values do not need to match the query, but they must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "frequency-order" or "item-order" may be specified in the options parameter. If neither "frequency-order" nor "item-order" is specified, then the default is "item-order".

Only one of "fragment-frequency" or "item-frequency" may be specified in the options parameter. If neither "fragment-frequency" nor "item-frequency" is specified, then the default is "fragment-frequency".

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending" if "item-order" is specified, and "descending" if "frequency-order" is specified.

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a range index with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then values from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

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

If the $query parameter is not present and the current user is assigned the admin role, values from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see values from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      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?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  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 : One or more element QNames.
$attribute-names : One or more attribute QNames.
$pattern : Wildcard pattern to match.
$options (optional): Options. The default is ().

Options include:

"case-sensitive"
A case-sensitive match.
"case-insensitive"
A case-insensitive match.
"diacritic-sensitive"
A diacritic-sensitive match.
"diacritic-insensitive"
A diacritic-insensitive match.
"ascending"
Words should be returned in ascending order.
"descending"
Words should be returned in descending order.
"any"
Words from any fragment should be included.
"document"
Words from document fragments should be included.
"properties"
Words from properties fragments should be included.
"locks"
Words from locks fragments should be included.
"collation=URI"
Use the lexicon with the collation specified by URI.
"truncate=N"
Include words only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include words in fragments selected by the cts:query. The words do not need to match the query, but the words must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending".

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a lexicon with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then words from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

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".

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

If the $query parameter is not present and the current user is assigned the admin role, words from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see words from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      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?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  xs:string*
Summary:

Returns words from the specified element-attribute word lexicon(s). 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. The words are returned in collation order.

Parameters:
$element-names : One or more element QNames.
$attribute-names : One or more 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"
Words should be returned in ascending order.
"descending"
Words should be returned in descending order.
"any"
Words from any fragment should be included.
"document"
Words from document fragments should be included.
"properties"
Words from properties fragments should be included.
"locks"
Words from locks fragments should be included.
"collation=URI"
Use the lexicon with the collation specified by URI.
"truncate=N"
Include words only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include words in fragments selected by the cts:query. The words do not need to match the query, but the words must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending".

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a lexicon with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then words from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

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

If the $query parameter is not present and the current user is assigned the admin role, words from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see words from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      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?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  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 : One or more element QNames.
$pattern : Wildcard pattern to match. The pattern is matched according to the collation of the range index used to resolve the query.
$options (optional): Options. The default is ().

Options include:

"case-sensitive"
A case-sensitive match.
"case-insensitive"
A case-insensitive match.
"diacritic-sensitive"
A diacritic-sensitive match.
"diacritic-insensitive"
A diacritic-insensitive match.
"ascending"
Values should be returned in ascending order.
"descending"
Values should be returned in descending order.
"any"
Values from any fragment should be included.
"document"
Values from document fragments should be included.
"properties"
Values from properties fragments should be included.
"locks"
Values from locks fragments should be included.
"frequency-order"
Values should be returned ordered by frequency.
"item-order"
Values should be returned ordered by collation.
"fragment-frequency"
Frequency should be the number of fragments with an included value. This option is used with cts:frequency.
"item-frequency"
Frequency should be the number of occurences of an included value. This option is used with cts:frequency.
"collation=URI"
Use the range index with the collation specified by URI.
"truncate=N"
Include values only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include values in fragments selected by the cts:query. The values do not need to match the query, but they must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "frequency-order" or "item-order" may be specified in the options parameter. If neither "frequency-order" nor "item-order" is specified, then the default is "item-order".

Only one of "fragment-frequency" or "item-frequency" may be specified in the options parameter. If neither "fragment-frequency" nor "item-frequency" is specified, then the default is "fragment-frequency".

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending" if "item-order" is specified, and "descending" if "frequency-order" is specified.

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a range index with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then values from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

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 $query parameter is not present and the current user is assigned the admin role, values from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see values from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      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?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  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 : One or more 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"
Values should be returned in ascending order.
"descending"
Values should be returned in descending order.
"any"
Values from any fragment should be included.
"document"
Values from document fragments should be included.
"properties"
Values from properties fragments should be included.
"locks"
Values from locks fragments should be included.
"frequency-order"
Values should be returned ordered by frequency.
"item-order"
Values should be returned ordered by collation.
"fragment-frequency"
Frequency should be the number of fragments with an included value. This option is used with cts:frequency.
"item-frequency"
Frequency should be the number of occurences of an included value. This option is used with cts:frequency.
"collation=URI"
Use the lexicon with the collation specified by URI.
"truncate=N"
Include values only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include values in fragments selected by the cts:query. The values do not need to match the query, but they must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "frequency-order" or "item-order" may be specified in the options parameter. If neither "frequency-order" nor "item-order" is specified, then the default is "item-order".

Only one of "fragment-frequency" or "item-frequency" may be specified in the options parameter. If neither "fragment-frequency" nor "item-frequency" is specified, then the default is "fragment-frequency".

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending" if "item-order" is specified, and "descending" if "frequency-order" is specified.

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a lexicon with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then values from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

If the $query parameter is not present and the current user is assigned the admin role, values from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see values from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      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?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  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 : One or more element QNames.
$pattern : Wildcard pattern to match.
$options (optional): Options. The default is ().

Options include:

"case-sensitive"
A case-sensitive match.
"case-insensitive"
A case-insensitive match.
"diacritic-sensitive"
A diacritic-sensitive match.
"diacritic-insensitive"
A diacritic-insensitive match.
"ascending"
Words should be returned in ascending order.
"descending"
Words should be returned in descending order.
"any"
Words from any fragment should be included.
"document"
Words from document fragments should be included.
"properties"
Words from properties fragments should be included.
"locks"
Words from locks fragments should be included.
"collation=URI"
Use the lexicon with the collation specified by URI.
"truncate=N"
Include words only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include words in fragments selected by the cts:query. The words do not need to match the query, but the words must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending".

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a lexicon with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then words from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

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 $query parameter is not present and the current user is assigned the admin role, words from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see words from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      cts:and-query( () ) 

Only words that can be matched with element-word-query are included. 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?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  xs:string*
Summary:

Returns words from the specified element word lexicon. This function requires an element word 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 : One or more 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"
Words should be returned in ascending order.
"descending"
Words should be returned in descending order.
"any"
Words from any fragment should be included.
"document"
Words from document fragments should be included.
"properties"
Words from properties fragments should be included.
"locks"
Words from locks fragments should be included.
"collation=URI"
Use the lexicon with the collation specified by URI.
"truncate=N"
Include words only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include words in fragments selected by the cts:query. The words do not need to match the query, but the words must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending".

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a lexicon with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then words from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

If the $query parameter is not present and the current user is assigned the admin role, words from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see words from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      cts:and-query( () ) 

Only words that can be matched with element-word-query are included. 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:field-word-match(
$field-names as xs:string*,
$pattern as xs:string,
[$options as xs:string*],
[$query as cts:query?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  xs:string*
Summary:

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

Parameters:
$field-names : One or more field names.
$pattern : Wildcard pattern to match.
$options (optional): Options. The default is ().

Options include:

"case-sensitive"
A case-sensitive match.
"case-insensitive"
A case-insensitive match.
"diacritic-sensitive"
A diacritic-sensitive match.
"diacritic-insensitive"
A diacritic-insensitive match.
"ascending"
Words should be returned in ascending order.
"descending"
Words should be returned in descending order.
"any"
Words from any fragment should be included.
"document"
Words from document fragments should be included.
"properties"
Words from properties fragments should be included.
"locks"
Words from locks fragments should be included.
"collation=URI"
Use the lexicon with the collation specified by URI.
"truncate=N"
Include words only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include words in fragments selected by the cts:query. The words do not need to match the query, but the words must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending".

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a lexicon with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then words from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

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 $query parameter is not present and the current user is assigned the admin role, words from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see words from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      cts:and-query( () ) 

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


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

cts:field-words(
$field-names as xs:string*,
[$start as xs:string],
[$options as xs:string*],
[$query as cts:query?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  xs:string*
Summary:

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

Parameters:
$field-names : One or more field names.
$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"
Words should be returned in ascending order.
"descending"
Words should be returned in descending order.
"any"
Words from any fragment should be included.
"document"
Words from document fragments should be included.
"properties"
Words from properties fragments should be included.
"locks"
Words from locks fragments should be included.
"collation=URI"
Use the lexicon with the collation specified by URI.
"truncate=N"
Include words only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include words in fragments selected by the cts:query. The words do not need to match the query, but the words must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending".

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a lexicon with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then words from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

If the $query parameter is not present and the current user is assigned the admin role, words from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see words from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      cts:and-query( () ) 

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


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

cts:fitness(
[$node as node()]
)  as  xs:float
Summary:

Returns the fitness of a node, or of the context node if no node is provided. Fitness is a normalized measure of relevance that is based on how well a node matches the query issued, not taking into account the number of documents in which the query term(s) occur.

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

Usage Notes:

Fitness is similar to score, except that it is bounded. It is similar to confidence, except that it is not influenced by term IDFs. It is an xs:float in the range of 0.0 to 1.0. It does not include quality.


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

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

cts:frequency(
$value as xs:string
)  as  xs:integer
Summary:

Returns an integer representing the number of times in which a particular value occurs in a value lexicon lookup (for example, cts:element-values). When using the fragment-frequency lexicon option, cts:frequency returns the number of fragments in which the lexicon value occurs. When using the item-frequency lexicon option, cts:frequency returns the total number of times in which the lexicon value occurs in each item.

Parameters:
$value : A value from a value lexicon lookup. The value should be one returned from the cts:element-values, cts:element-attribute-values, or the corresponding value-match lexicon APIs.

Usage Notes:

You must have a Range index configured to use the value lexicon APIs (cts:element-values, cts:element-value-match, cts:element-attribute-values, or cts:element-attribute-value-match).

If the value specified is not from a value lexicon lookup, cts:frequency returns a frequency of 0.

The frequency returned from cts:frequency is fragment-based by default (using the default fragment-frequency option in the lexicon API). If there are multiple occurences of the value in any given fragment, the frequency is still one per fragment when using fragment-frequency. Therefore, if the value returned is 13, it means that the value occurs in 13 fragments.

If you want the total frequency instead of the fragment-based frequency (that is, the total number of occurences of the value in the items specified in the cts:query option of the lexicon API), you must specify the item-frequency option to the lexicon API value input to cts:frequency. For example, the second example below specifies an item-frequency and a cts:document-query in the lexicon API, so the item frequency is how many times each speaker speaks in the play (because the constraining query is a document query of hamlet.xml, which contains the whole play).


Example:
<results>{
let $x := cts:element-values(xs:QName("SPEAKER"),"",(), 
  cts:document-query("/shakespeare/plays/hamlet.xml") )
for $speaker in $x
return 
(
<result>
  <SPEAKER>{$speaker}</SPEAKER> 
  <NUMBER-OF-SPEECHES>{cts:frequency($speaker)}</NUMBER-OF-SPEECHES> 
</result>
)
}</results>

=> Returns the names of the speakers in Hamlet
   with the number of times they speak. If the
   play is fragmented at the SCENE level, then 
   it returns the number of scenes in which each 
   speaker speaks. 
Example:
<results>{
let $x := cts:element-values(xs:QName("SPEAKER"),
  "", "item-frequency", 
  cts:document-query("/shakespeare/plays/hamlet.xml") )
for $speaker in $x
return 
(
<result>
  <SPEAKER>{$speaker}</SPEAKER> 
  <NUMBER-OF-SPEECHES>
    {cts:frequency($speaker)}
  </NUMBER-OF-SPEECHES> 
</result>
)
}</results>

=> Returns the names of the speakers in Hamlet
   with the number of times they speak. Returns
   the total times they speak, regardless
   of fragmentation. 

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 : A node to highlight. The node must be either a document node or an element node; it cannot be a text node.
$query : A query specifying the text to highlight.
$expr : An 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): A 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 xdmp:node-uri($a) => /test.xml

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

Register a query for later use.

Parameters:
$query : A query to register.

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

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

Returns an estimated search result size for a node, or of the context node if no node is provided. The search result size for a node is the number of fragments remaining (including the current node) in the result sequence containing the node. This is useful to quickly estimate the size of a search result sequence, without using fn:count() or xdmp:estimate().

Parameters:
$node (optional): A node. Typically this is an item in the result sequence of a cts:search operation. If you specify the first item from a cts:search expression, then cts:remainder will return an estimate of the number of fragments that match that expression.

Usage Notes:

This function makes it efficient to estimate the size of a search result and execute that search in the same query. If you only need an estimate of the size of a search but do not need to run the search, then xdmp:estimate is more efficient.

To return the estimated size of a search with cts:remainder, use the first item of a cts:search result sequence as the parameter to cts:remainder. For example, the following query returns the estimated number of fragments that contain the word "dog":

  cts:remainder(cts:search(collection(), "dog")[1]) 

When you put the position predicate on the cts:search result sequence, MarkLogic Server will filter all of the false positives up to the specified position, but not the false positives beyond the specified position. Because of this, when you increase the position number in the parameter, the result from cts:remainder might decrease by a larger number than the increase in position number, or it might not decrease at all. For example, if the query above returned 10, then the following query might return 9, it might return 10, or it might return less than 9, depending on how the results are dispersed throughout different fragments:

  cts:remainder(cts:search(collection(), "dog")[2]) 

If you run cts:remainder 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:
  let $x := cts:search(collection(), "dog")
  return
  ( cts:remainder($x[1]), $x )

   => Returns the estimated number of items in the search 
      for "dog" followed by the results of the search.
Example:
  xdmp:document-insert("/test.xml", <a>my test</a>);
  for $x in cts:search(collection(),"my test")
  return cts:remainder($x) => 1
Example:
  for $a in cts:search(collection(),"my test")
  where $a[cts:remainder() eq 1]
  return xdmp:node-uri($a) => /test.xml

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

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

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

Usage Notes:

Score is computed according to the scoring method specified in the cts:search expression, if any.

If you run cts:score 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:
(: run this on the Shakespeare content set :)
for $hit in cts:search(//SPEECH,
    cts:word-query("with flowers"))[1 to 10]
return element hit {
  attribute score { cts:score($hit) },
  $hit
}
Example:
  xdmp:document-insert("/test.xml", <a>my test</a>);
  for $x in cts:search(doc("/test.xml"),"my test")
  return cts:score($x) => 11
Example:
  for $a in cts:search(collection(),"my test") 
  where $a[cts:score() gt 10]
  return xdmp:node-uri($a) => /test.xml

cts:search(
$expression as node()*,
$query as cts:query?,
[$options as xs:string*],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  node()*
Summary:

Returns a relevance-ordered sequence of nodes specified by a given query.

Parameters:
$expression : An expression to be searched. This must be an inline fully searchable path expression.
$query : A cts:query specifying the search to perform. If a string is entered, the string is treated as a cts:word-query of the specified string.
$options (optional): Options to this search. The default is ().

Options include:

"filtered"

A filtered search (the default). Filtered searches eliminate any false positive matches and properly resolve cases where there are multiple candidate matches within the same fragment, thereby guaranteeing that the results fully satisfy the specified cts:query.

"unfiltered"

An unfiltered search. An unfiltered search selects fragments from the indexes that are candidates to satisfy the specified cts:query, and then it returns a single node from within each fragment that satisfies the specified searchable path expression. Unfiltered searches are useful because of the performance they afford when jumping deep into the result set (for example, when paginating a long result set and jumping to the 1,000,000th result). However, depending on the searchable path expression, the cts:query specified, the structure of the documents in the database, and the configuration of the database, unfiltered searches may result in false positives being included in the search results. Unfiltered searches may also result in missed matches or in incorrect matches, especially when there are multiple candidate matches within a single fragment. To avoid these problems, you should only use unfiltered searches on top-level XPath expressions (for example, document nodes, collections, directories) or on fragment roots. Using unfiltered searches on complex XPath expressions or on XPath expressions that traverse below a fragment root can result in unexpected results.

"score-logtfidf"

Compute scores using the logtfidf method (the default scoring method). This uses the formula:

  log(term frequency) * (inverse document frequency)

"score-logtf"

Compute scores using the logtf method. This does not take into account how many documents have the term and uses the formula:

  log(term frequency)

"score-simple"

Compute scores using the simple method. The score-simple method gives a score of 8*weight for each matching term in the cts:query expression. It does not matter how many times a given term matches (that is, the term frequency does not matter); each match contributes 8*weight to the score. For example, the following query (assume the default weight of 1) would give a score of 8 for any fragment with one or more matches for "hello", a score of 16 for any fragment that also has one or more matches for "goodbye", or a score of zero for fragments that have no matches for either term:

  cts:or-query(("hello", "goodbye"))

"checked"

Word positions are checked (the default) when resolving the query. Checked searches eliminate false positive matches for phrases during the index resolution phase of search processing.

"unchecked"

Word positions are not checked when resolving the query. Unchecked searches do not take into account word positions and can lead to false positive matches during the index resolution phase of search processing. This setting is useful for debugging, but not recommended for normal use.

$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is (). You can use cts:search with this parameter and an empty cts:and-query to specify a forest-specific XPath statement (see the third example below). If you use this to constrain an XPath to one or more forests, you should set the quality-weight to zero to keep the XPath document order.

Usage Notes:

Queries that use cts:search require that the XPath expression searched is fully searchable. A fully searchable path is one that has no steps that are unsearchable. You can use the xdmp:query-trace() function to see if the path is fully searchable. If there are no entries in the xdmp:query-trace() output indicating that a step is unsearchable, then that path is fully searchable. Queries that use cts:search on unsearchable XPath expressions will fail with an an error message. You can often make the path expressions fully searchable by rewriting the query or adding new indexes.

Each node that cts:search returns has a score with which it is associated. To access the score, use the cts:score function. The nodes are returned in relevance order (most relevant to least relevant), where more relevant nodes have a higher score.

Only one of the "filtered" or "unfiltered" options may be specified in the options parameter. If neither "filtered" nor "unfiltered", is specified then the default is "filtered".

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf" are specified, or "score-simple", then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If the neither "checked" nor "unchecked" are specified, then the default is "checked".

If the cts:query specified is the empty string (equivalent to cts:word-query("")), then the search returns the empty sequence.


Example:
  cts:search(//SPEECH,
    cts:word-query("with flowers"))
  
  => ... a sequence of 'SPEECH' element ancestors (or self)
     of any node containing the phrase 'with flowers'.
Example:
  cts:search(collection("self-help")/book,
    cts:element-query(xs:QName("title"), "meditation"),
    "score-simple", 1.0, (xdmp:forest("prod"),xdmp:forest("preview")))

  => ... a sequence of book elements matching the XPath
     expression which are members of the "self-help"
     collection, reside in the the "prod" or "preview" forests and
     contain "meditation" in the title element, using the
     "score-simple" option.
Example:
  cts:search(/some/xpath, cts:and-query( () ), (), 0.0,
    xdmp:forest("myForest"))

  => ... a sequence of /some/xpath elements that are
     in the forest named "myForest".  Note the 
     empty and-query, which matches all documents (and
     scores them all the same) and the quality-weight
     of 0, which together make each result have a score
     of 0, which keeps the results in document order.

cts:stem(
$text as xs:string,
[$language as xs:string]
)  as  xs:string*
Summary:

Stems a word.

Parameters:
$text : A word or phrase to stem.
$language (optional): A language to use for stemming. If not supplied, it uses the database default language.

Example:
cts:stem("ran","en")
=> "run"

cts:tokenize(
$text as xs:string,
[$language as xs:string]
)  as  cts:token*
Summary:

Tokenizes text into words, punctuation, and spaces. Returns output in the type cts:token, which has subtypes cts:word, cts:punctuation, and cts:space, all of which are subtypes of xs:string.

Parameters:
$text : A word or phrase to tokenize.
$language (optional): A language to use for tokenization. If not supplied, it uses the database default language.

Usage Notes:

When you tokenize a string with cts:tokenize, each word is represented by an instance of cts:word, each punctuation character is represented by an instance of cts:punctuation, each set of adjacent spaces is represented by an instance of cts:space, and each set of adjacent line breaks is represented by an instance of cts:space.

Unlike the standard XQuery function fn:tokenize, cts:tokenize returns words, punctuation, and spaces as different types. You can therefore use a typeswitch to handle each type differently. For example, you can use cts:tokenize to remove all punctuation from a string, or create logic to test for the type and return different things for different types, as shown in the first two examples below.

You can use xdmp:describe to show how a given string will be tokenized. When run on the results of cts:tokenize, the xdmp:describe function returns the types and the values for each token. For a sample of this pattern, see the third example below.


Example:
(: Remove all punctuation :)
let $string := "The red, blue, green, and orange
                balloons were launched!" 
let $noPunctuation := 
  for $token in cts:tokenize($string)
  return
    typeswitch ($token)
     case $token as cts:punctuation return ""
     case $token as cts:word return $token
     case $token as cts:space return $token
     default return ()
return string-join($noPunctuation, "")
  
=> The red blue green and orange balloons were launched
Example:
(: Insert the string "XX" before and after 
   all punctuation tokens :)
let $string := "The red, blue, green, and orange
                 balloons were launched!"
let $tokens := cts:tokenize($string)
return string-join(
for $x in $tokens
return if ( $x instance of cts:punctuation )
       then ( concat("XX",
                     $x, "XX") )
       else ( $x ) , "")
 => The redXX,XX blueXX,XX greenXX,XX and orange
    balloons were launchedXX!XX
 
Example:
(: show the types and tokens for a string :)
xdmp:describe(cts:tokenize("blue, green"))

=> (cts:word("blue"), cts:punctuation(","), 
    cts:space(" "), cts:word("green"))

cts:uri-match(
$pattern as xs:string,
[$options as xs:string*],
[$query as cts:query?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  xs:string*
Summary:

Returns values from the URI lexicon that match the specified wildcard pattern. This function requires the uri-lexicon database configuration parameter to be enabled. If the uri-lexicon database-configuration parameter is not enabled, an exception is thrown.

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

Options include:

"case-sensitive"
A case-sensitive match.
"case-insensitive"
A case-insensitive match.
"diacritic-sensitive"
A diacritic-sensitive match.
"diacritic-insensitive"
A diacritic-insensitive match.
"ascending"
URIs should be returned in ascending order.
"descending"
URIs should be returned in descending order.
"any"
URIs from any fragment should be included.
"document"
URIs from document fragments should be included.
"properties"
URIs from properties fragments should be included.
"locks"
URIs from locks fragments should be included.
"frequency-order"
URIs should be returned ordered by frequency.
"item-order"
URIs should be returned ordered by collation.
"truncate=N"
Include URIs only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include URIs from fragments selected by the cts:query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "frequency-order" or "item-order" may be specified in the options parameter. If neither "frequency-order" nor "item-order" is specified, then the default is "item-order".

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending" if "item-order" is specified, and "descending" if "frequency-order" is specified.

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "truncate=N" is not specfied in the options parameter, then URIs from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

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 $query parameter is not present and the current user is assigned the admin role, URIs from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see URIs from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      cts:and-query( () ) 


Example:
  cts:uri-match("http://foo.com/*.html")
  => ("http://foo.com/bar.html", "http://foo.com/baz/bork.html", ...)

cts:uris(
[$start as xs:string],
[$options as xs:string*],
[$query as cts:query?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  xs:string*
Summary:

Returns values from the URI lexicon. This function requires the uri-lexicon database configuration parameter to be enabled. If the uri-lexicon database-configuration parameter is not enabled, an exception is thrown.

Parameters:
$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"
URIs should be returned in ascending order.
"descending"
URIs should be returned in descending order.
"any"
URIs from any fragment should be included.
"document"
URIs from document fragments should be included.
"properties"
URIs from properties fragments should be included.
"locks"
URIs from locks fragments should be included.
"frequency-order"
URIs should be returned ordered by frequency.
"item-order"
URIs should be returned ordered by collation.
"truncate=N"
Include URIs only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include URIs from fragments selected by the cts:query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "frequency-order" or "item-order" may be specified in the options parameter. If neither "frequency-order" nor "item-order" is specified, then the default is "item-order".

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending" if "item-order" is specified, and "descending" if "frequency-order" is specified.

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "truncate=N" is not specfied in the options parameter, then URIs from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

If the $query parameter is not present and the current user is assigned the admin role, URIs from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see URIs from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      cts:and-query( () ) 


Example:
  cts:uris("http://foo.com/")
  => ("http://foo.com/", "http://foo.com/bar.html", ...)

cts:word-match(
$pattern as xs:string,
[$options as xs:string*],
[$query as cts:query?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  xs:string*
Summary:

Returns words from the word lexicon that match the wildcard pattern. This function requires the word lexicon to be enabled. If the word lexicon is not enabled, an exception is thrown.

Parameters:
$pattern : A wildcard pattern to match.
$options (optional): Options. The default is ().

Options include:

"case-sensitive"
A case-sensitive match.
"case-insensitive"
A case-insensitive match.
"diacritic-sensitive"
A diacritic-sensitive match.
"diacritic-insensitive"
A diacritic-insensitive match.
"ascending"
Words should be returned in ascending order.
"descending"
Words should be returned in descending order.
"any"
Words from any fragment should be included.
"document"
Words from document fragments should be included.
"properties"
Words from properties fragments should be included.
"locks"
Words from locks fragments should be included.
"collation=URI"
Use the lexicon with the collation specified by URI.
"truncate=N"
Include words only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include words in fragments selected by the cts:query. The words do not need to match the query, but the words must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending".

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a lexicon with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then words from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

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 $query parameter is not present and the current user is assigned the admin role, words from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see words from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

      cts:and-query( () ) 


Example:
  cts:word-match("aardvark*")
  => ("aardvark","aardvarks")

cts:words(
[$start as xs:string],
[$options as xs:string*],
[$query as cts:query?],
[$quality-weight as xs:double],
[$forest-ids as xs:unsignedLong*]
)  as  xs:string*
Summary:

Returns words from the word lexicon. This function requires the word lexicon to be enabled. If the word lexicon is not enabled, an exception is thrown. The words are returned in collation order.

Parameters:
$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"
Words should be returned in ascending order.
"descending"
Words should be returned in descending order.
"any"
Words from any fragment should be included.
"document"
Words from document fragments should be included.
"properties"
Words from properties fragments should be included.
"locks"
Words from locks fragments should be included.
"collation=URI"
Use the lexicon with the collation specified by URI.
"truncate=N"
Include words only from the first N fragments selected by the cts:query. Only applies when a $query parameter is specified.
"score-logtfidf"
Compute scores using the logtfidf method.
"score-logtf"
Compute scores using the logtf method.
"score-simple"
Compute scores using the simple method.
"checked"
Word positions should be checked when resolving the query.
"unchecked"
Word positions should not be checked when resolving the query.
$query (optional): Only include words in fragments selected by the cts:query. The words do not need to match the query, but the words must occur in fragments selected by the query. The fragments are not filtered to ensure they match the query, but instead selected in the same manner as "unfiltered" cts:search operations.
$quality-weight (optional): A document quality weight to use when computing scores. The default is 1.0.
$forest-ids (optional): A sequence of IDs of forests to which the search will be constrained. An empty sequence means to search all forests in the database. The default is ().

Usage Notes:

Only one of "ascending" or "descending" may be specified in the options parameter. If neither "ascending" nor "descending" is specified, then the default is "ascending".

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

Only one of the "score-logtfidf", "score-logtf", or "score-simple" options may be specified in the options parameter. If none of "score-logtfidf", "score-logtf", or "score-simple", are specified, then the default is "score-logtfidf".

Only one of the "checked" or "unchecked" options may be specified in the options parameter. If neither "checked" nor "unchecked" are specified, then the default is "checked".

If "collation=URI" is not specified in the options parameter, then the default collation is used. If a lexicon with that collation does not exist, an error is thrown.

If "truncate=N" is not specfied in the options parameter, then words from all fragments selected by the $query parameter are included. If a $query parameter is not present, then "truncate=N" has no effect.

If the $query parameter is not present and the current user is assigned the admin role, words from deleted fragments not yet expunged by a merge may be included. Users who are not part of the admin role will not see words from deleted fragments. To filter deleted fragments for the admin role case, use a $query parameter. For example, the following query returns all documents, but would have the effect of filtering out deleted fragments for admin users:

    cts:words("abc", (), cts:and-query( () ) )


Example:
  cts:words("aardvark")
  => ("aardvark","aardvarks","aardwolf",...)