|
|
cts:element-attribute-value-match(
|
|
$element-names as xs:QName*,
|
|
$attribute-names as xs:QName*,
|
|
$pattern as xs:string,
|
|
[$options as xs:string*],
|
|
[$query as cts:query?]
|
| ) as xs:string* |
|
 |
Summary:
Returns values from the specified element-attribute value lexicon(s)
that match the specified wildcard pattern. Element-attribute value
lexicons are implemented using string range indexes; consequently this
function requires an attribute range index of type xs:string
for each of the element/attribute pairs specified
in the function. If there is not a string range index configured
for any of the specified element/attribute pairs, then an
exception is thrown.
|
Parameters:
$element-names
:
The element QNames.
|
$attribute-names
:
The attribute QNames.
|
$pattern
:
Wildcard pattern to match.
|
$options
(optional):
Options. The default is ().
Options include:
- "case-sensitive"
- Specifies a case-sensitive match.
- "case-insensitive"
- Specifies a case-insensitive match.
- "diacritic-sensitive"
- Specifies a diacritic-sensitive match.
- "diacritic-insensitive"
- Specifies a diacritic-insensitive match.
- "ascending"
- Specifies that values should be returned in ascending order.
- "descending"
- Specifies that values should be returned in descending order.
- "any"
- Specifies that values in any fragment should be returned.
- "document"
- Specifies that values in document fragments should be returned.
- "properties"
- Specifies that values in properties fragments should be returned.
- "locks"
- Specifies that values in locks fragments should be returned.
|
$query
(optional):
Only return values that exist in fragments selected by the
cts:query. That is, the values do not need
to match the query, but they must occur in fragments that match
the query.
|
|
Usage Notes:
If multiple element and/or attribute QNames are specified,
then all possible element/attribute QName combinations are used
to select the matching values.
Note the following interactions about the options:
If neither "case-sensitive" nor "case-insensitive"
is present, $pattern is used to determine case sensitivity.
If $pattern contains no uppercase, it specifies "case-insensitive".
If $pattern contains uppercase, it specifies "case-sensitive".
If neither "diacritic-sensitive" nor "diacritic-insensitive"
is present, $pattern is used to determine diacritic sensitivity.
If $pattern contains no diacritics, it specifies "diacritic-insensitive".
If $pattern contains diacritics, it specifies "diacritic-sensitive".
If the options parameter contains neither "ascending" nor "descending",
then the default is "ascending".
At most one of "any", "document", "properties", or "locks"
may be specified in the options parameter.
If the options parameter contains none of "any", "document",
"properties", or "locks", then the default is "any".
If the $query parameter is not present, and the current user is assigned
the admin role, no value filtering is performed. Values may be returned that
only appear in deleted fragments not yet expunged by a merge.
To filter deleted values in this case, use a $query parameter.
For example:
cts:and-query( () )
|
Example:
cts:element-attribute-value-match(xs:QName("animals"),
xs:QName("name"),"aardvark*")
=> ("aardvark","aardvarks")
|
|
|
|
cts:element-attribute-values(
|
|
$element-names as xs:QName*,
|
|
$attribute-names as xs:QName*,
|
|
[$start as xs:string],
|
|
[$options as xs:string*],
|
|
[$query as cts:query?]
|
| ) as xs:string* |
|
 |
Summary:
Returns values from the specified element-attribute value lexicon(s).
Element-attribute value lexicons are implemented using string range
indexes; consequently this function requires an attribute range index
of type xs:string or xs:anyURI for each of
the element/attribute pairs specified in the function. If there is not
a string range index configured for any of the specified
element/attribute pairs, then an exception is thrown. The values are
returned in collation order.
|
Parameters:
$element-names
:
The element QNames.
|
$attribute-names
:
The attribute QNames.
|
$start
(optional):
A starting value. Return only this value and following values. If
the empty string, return all values. If the parameter is not in
the lexicon, then it returns the values beginning with the next
value.
|
$options
(optional):
Options. The default is ().
Options include:
- "ascending"
- Specifies that values should be returned in ascending order.
- "descending"
- Specifies that values should be returned in descending order.
- "any"
- Specifies that values in any fragment should be returned.
- "document"
- Specifies that values in document fragments should be returned.
- "properties"
- Specifies that values in properties fragments should be returned.
- "locks"
- Specifies that values in locks fragments should be returned.
|
$query
(optional):
Only return values that exist in fragments selected by the
cts:query. That is, the values do not need
to match the query, but they must occur in fragments that match
the query.
|
|
Usage Notes:
If multiple element and/or attribute QNames are specified,
then all possible element/attribute QName combinations are used
to select the matching values.
If the options parameter contains neither "ascending" nor "descending",
then the default is "ascending".
At most one of "any", "document", "properties", or "locks"
may be specified in the options parameter.
If the options parameter contains none of "any", "document",
"properties", or "locks", then the default is "any".
If the $query parameter is not present, and the current user is assigned
the admin role, no value filtering is performed. Values may be returned that
only appear in deleted fragments not yet expunged by a merge.
O filter deleted values in this case, use a $query parameter.
For example:
cts:and-query( () )
|
Example:
cts:element-attribute-values(xs:QName("animal"),
xs:QName("name"),
"aardvark")
=> ("aardvark","aardvarks","aardwolf",...)
|
|
|
|
cts:element-attribute-word-match(
|
|
$element-names as xs:QName*,
|
|
$attribute-names as xs:QName*,
|
|
$pattern as xs:string,
|
|
[$options as xs:string*],
|
|
[$query as cts:query?]
|
| ) as xs:string* |
|
 |
Summary:
Returns words from the specified element-attribute word lexicon(s) that
match a wildcard pattern. This function requires an element-attribute
word lexicon for each of the element/attribute pairs specified in the
function. If there is not an element-attribute word lexicon
configured for any of the specified element/attribute pairs, then
an exception is thrown.
|
Parameters:
$element-names
:
The element QNames.
|
$attribute-names
:
The attribute QNames.
|
$pattern
:
Wildcard pattern to match.
|
$options
(optional):
Options. The default is ().
Options include:
- "case-sensitive"
- Specifies a case-sensitive match.
- "case-insensitive"
- Specifies a case-insensitive match.
- "diacritic-sensitive"
- Specifies a diacritic-sensitive match.
- "diacritic-insensitive"
- Specifies a diacritic-insensitive match.
- "ascending"
- Specifies that words should be returned in ascending order.
- "descending"
- Specifies that words should be returned in descending order.
- "any"
- Specifies that words in any fragment should be returned.
- "document"
- Specifies that words in document fragments should be returned.
- "properties"
- Specifies that words in properties fragments should be returned.
- "locks"
- Specifies that words in locks fragments should be returned.
|
$query
(optional):
Only return words that exist in fragments selected by the
cts:query. That is, the words do not need
to match the query, but the words must occur in fragments that match
the query.
|
|
Usage Notes:
If multiple element and/or attribute QNames are specified,
then all possible element/attribute QName combinations are used
to select the matching values.
Note the following interactions about the options:
If neither "case-sensitive" nor "case-insensitive"
is present, $pattern is used to determine case sensitivity.
If $pattern contains no uppercase, it specifies "case-insensitive".
If $pattern contains uppercase, it specifies "case-sensitive".
If neither "diacritic-sensitive" nor "diacritic-insensitive"
is present, $pattern is used to determine diacritic sensitivity.
If $pattern contains no diacritics, it specifies "diacritic-insensitive".
If $pattern contains diacritics, it specifies "diacritic-sensitive".
If the options parameter contains neither "ascending" nor "descending",
then the default is "ascending".
At most one of "any", "document", "properties", or "locks"
may be specified in the options parameter.
If the options parameter contains none of "any", "document",
"properties", or "locks", then the default is "any".
If the $query parameter is not present, and the current user is assigned
the admin role, no word filtering is performed. Words may be returned that
only appear in deleted fragments not yet expunged by a merge.
To filter deleted words in this case, use a $query parameter.
For example:
cts:and-query( () )
|
Example:
cts:element-word-match(xs:QName("animals"),"aardvark*")
=> ("aardvark","aardvarks")
|
|
|
|
cts:element-attribute-words(
|
|
$element-names as xs:QName*,
|
|
$attribute-names as xs:QName*,
|
|
[$start as xs:string],
|
|
[$options as xs:string*],
|
|
[$query as cts:query?]
|
| ) as xs:string* |
|
 |
Summary:
Returns words from the specified element-attribute word lexicon(s).
This function requires an element-attribute lexicon for each of the
element/attribute pairs specified in the function. If there is not an
element/attribute word lexicon configured for any of the specified
element/attribute pairs, then an exception is thrown. The words are
returned in collation order.
|
Parameters:
$element-names
:
The element QNames.
|
$attribute-names
:
The attribute QNames.
|
$start
(optional):
A starting word. Returns only this word and any following words
from the lexicon. If this parameter is the empty string, it returns
all of the words. If the parameter is not in the lexicon, then it
returns the words beginning with the next word.
|
$options
(optional):
Options. The default is ().
Options include:
- "ascending"
- Specifies that words should be returned in ascending order.
- "descending"
- Specifies that words should be returned in descending order.
- "any"
- Specifies that words in any fragment should be returned.
- "document"
- Specifies that words in document fragments should be returned.
- "properties"
- Specifies that words in properties fragments should be returned.
- "locks"
- Specifies that words in locks fragments should be returned.
|
$query
(optional):
Only return words that exist in fragments selected by the
cts:query. That is, the words do not need
to match the query, but the words must occur in fragments that match
the query.
|
|
Usage Notes:
If multiple element and/or attribute QNames are specified,
then all possible element/attribute QName combinations are used
to select the matching values.
If the options parameter contains neither "ascending" nor "descending",
then the default is "ascending".
At most one of "any", "document", "properties", or "locks"
may be specified in the options parameter.
If the options parameter contains none of "any", "document",
"properties", or "locks", then the default is "any".
If the $query parameter is not present, and the current user is assigned
the admin role, no word filtering is performed. Words may be returned that
only appear in deleted fragments not yet expunged by a merge.
To filter deleted words in this case, use a $query parameter.
For example:
cts:and-query( () )
|
Example:
cts:element-attribute-words(xs:QName("animal"),
xs:QName("name"),
"aardvark")
=> ("aardvark","aardvarks","aardwolf",...)
|
|
|
|
cts:element-value-match(
|
|
$element-names as xs:QName*,
|
|
$pattern as xs:string,
|
|
[$options as xs:string*],
|
|
[$query as cts:query?]
|
| ) as xs:string* |
|
 |
Summary:
Returns values from the specified element value lexicon(s)
that match the specified wildcard pattern. Element value lexicons
are implemented using string range indexes; consequently this function
requires an element range index of type xs:string for
each element specified in the function. If there is not a string range
index configured for any of the specified elements, then an exception
is thrown.
|
Parameters:
$element-names
:
The element QNames.
|
$pattern
:
Wildcard pattern to match.
|
$options
(optional):
Options. The default is ().
Options include:
- "case-sensitive"
- Specifies a case-sensitive match.
- "case-insensitive"
- Specifies a case-insensitive match.
- "diacritic-sensitive"
- Specifies a diacritic-sensitive match.
- "diacritic-insensitive"
- Specifies a diacritic-insensitive match.
- "ascending"
- Specifies that values should be returned in ascending order.
- "descending"
- Specifies that values should be returned in descending order.
- "any"
- Specifies that values in any fragment should be returned.
- "document"
- Specifies that values in document fragments should be returned.
- "properties"
- Specifies that values in properties fragments should be returned.
- "locks"
- Specifies that values in locks fragments should be returned.
|
$query
(optional):
Only return values that exist in fragments selected by the
cts:query. That is, the values do not need
to match the query, but they must occur in fragments that match
the query.
|
|
Usage Notes:
Note the following interactions about the options:
If neither "case-sensitive" nor "case-insensitive"
is present, $pattern is used to determine case sensitivity.
If $pattern contains no uppercase, it specifies "case-insensitive".
If $pattern contains uppercase, it specifies "case-sensitive".
If neither "diacritic-sensitive" nor "diacritic-insensitive"
is present, $pattern is used to determine diacritic sensitivity.
If $pattern contains no diacritics, it specifies "diacritic-insensitive".
If $pattern contains diacritics, it specifies "diacritic-sensitive".
If the options parameter contains neither "ascending" nor "descending",
then the default is "ascending".
At most one of "any", "document", "properties", or "locks"
may be specified in the options parameter.
If the options parameter contains none of "any", "document",
"properties", or "locks", then the default is "any".
If the $query parameter is not present, and the current user is assigned
the admin role, no value filtering is performed. Values may be returned that
only appear in deleted fragments not yet expunged by a merge.
To filter deleted values in this case, use a $query parameter.
For example:
cts:and-query( () )
|
Example:
cts:element-value-match(xs:QName("animal"),"aardvark*")
=> ("aardvark","aardvarks")
|
|
|
|
cts:element-values(
|
|
$element-names as xs:QName*,
|
|
[$start as xs:string],
|
|
[$options as xs:string*],
|
|
[$query as cts:query?]
|
| ) as xs:string* |
|
 |
Summary:
Returns values from the specified element value lexicon(s). Element
value lexicons are implemented using string range indexes;
consequently this function requires an element index of type
xs:string or xs:anyURI for each element
specified in the function. If there is not a string range index
configured for any of the specified elements, an exception is thrown.
The values are returned in collation order.
|
Parameters:
$element-names
:
The element QNames.
|
$start
(optional):
A starting value. Return only this value and following values. If
the empty string, return all values. If the parameter is is not in
the lexicon, then it returns the values beginning with the next
value.
|
$options
(optional):
Options. The default is ().
Options include:
- "ascending"
- Specifies that values should be returned in ascending order.
- "descending"
- Specifies that values should be returned in descending order.
- "any"
- Specifies that values in any fragment should be returned.
- "document"
- Specifies that values in document fragments should be returned.
- "properties"
- Specifies that values in properties fragments should be returned.
- "locks"
- Specifies that values in locks fragments should be returned.
|
$query
(optional):
Only return values that exist in fragments selected by the
cts:query. That is, the values do not need
to match the query, but they must occur in fragments that match
the query.
|
|
Usage Notes:
If the options parameter contains neither "ascending" nor "descending",
then the default is "ascending".
At most one of "any", "document", "properties", or "locks"
may be specified in the options parameter.
If the options parameter contains none of "any", "document",
"properties", or "locks", then the default is "any".
If the $query parameter is not present, and the current user is assigned
the admin role, no value filtering is performed. Values may be returned that
only appear in deleted fragments not yet expunged by a merge.
To filter deleted values in this case, use a $query parameter.
For example:
cts:and-query( () )
|
Example:
cts:element-values(xs:QName("animal"),"aardvark")
=> ("aardvark","aardvarks","aardwolf",...)
|
|
|
|
cts:element-word-match(
|
|
$element-names as xs:QName*,
|
|
$pattern as xs:string,
|
|
[$options as xs:string*],
|
|
[$query as cts:query?]
|
| ) as xs:string* |
|
 |
Summary:
Returns words from the specified element word lexicon(s) that match
a wildcard pattern. This function requires an element word lexicon
configured for each of the specified elements in the function. If there
is not an element word lexicon configured for any of the specified
elements, an exception is thrown.
|
Parameters:
$element-names
:
The element QNames.
|
$pattern
:
Wildcard pattern to match.
|
$options
(optional):
Options. The default is ().
Options include:
- "case-sensitive"
- Specifies a case-sensitive match.
- "case-insensitive"
- Specifies a case-insensitive match.
- "diacritic-sensitive"
- Specifies a diacritic-sensitive match.
- "diacritic-insensitive"
- Specifies a diacritic-insensitive match.
- "ascending"
- Specifies that words should be returned in ascending order.
- "descending"
- Specifies that words should be returned in descending order.
- "any"
- Specifies that words in any fragment should be returned.
- "document"
- Specifies that words in document fragments should be returned.
- "properties"
- Specifies that words in properties fragments should be returned.
- "locks"
- Specifies that words in locks fragments should be returned.
|
$query
(optional):
Only return words that exist in fragments selected by the
cts:query. That is, the words do not need
to match the query, but the words must occur in fragments that match
the query.
|
|
Usage Notes:
Note the following interactions about the options:
If neither "case-sensitive" nor "case-insensitive"
is present, $pattern is used to determine case sensitivity.
If $pattern contains no uppercase, it specifies "case-insensitive".
If $pattern contains uppercase, it specifies "case-sensitive".
If neither "diacritic-sensitive" nor "diacritic-insensitive"
is present, $pattern is used to determine diacritic sensitivity.
If $pattern contains no diacritics, it specifies "diacritic-insensitive".
If $pattern contains diacritics, it specifies "diacritic-sensitive".
If the options parameter contains neither "ascending" nor "descending",
then the default is "ascending".
At most one of "any", "document", "properties", or "locks"
may be specified in the options parameter.
If the options parameter contains none of "any", "document",
"properties", or "locks", then the default is "any".
If the $query parameter is not present, and the current user is assigned
the admin role, no word filtering is performed. Words may be returned that
only appear in deleted fragments not yet expunged by a merge.
To filter deleted words in this case, use a $query parameter.
For example:
cts:and-query( () )
Only words that can be matched with element-word-query are returned.
That is, only words present in immediate text node children of the
specified element as well as any text node children of child elements
defined in the Admin Interface as element-word-query-throughs or
phrase-throughs.
|
Example:
cts:element-word-match(xs:QName("animal"),"aardvark*")
=> ("aardvark","aardvarks")
|
|
|
|
cts:element-words(
|
|
$element-names as xs:QName*,
|
|
[$start as xs:string],
|
|
[$options as xs:string*],
|
|
[$query as cts:query?]
|
| ) as xs:string* |
|
 |
Summary:
Returns words from the specified element word lexicon. This function
requires an element lexicon for each of the element specified in the
function. If there is not an element word lexicon configured for any
of the specified elements, an exception is thrown. The words are
returned in collation order.
|
Parameters:
$element-names
:
The element QNames.
|
$start
(optional):
A starting word. Returns only this word and any following words
from the lexicon. If this parameter is the empty string, it returns
all of the words. If the parameter is not in the lexicon, then it
returns the words beginning with the next word.
|
$options
(optional):
Options. The default is ().
Options include:
- "ascending"
- Specifies that words should be returned in ascending order.
- "descending"
- Specifies that words should be returned in descending order.
- "any"
- Specifies that words in any fragment should be returned.
- "document"
- Specifies that words in document fragments should be returned.
- "properties"
- Specifies that words in properties fragments should be returned.
- "locks"
- Specifies that words in locks fragments should be returned.
|
$query
(optional):
Only return words that exist in fragments selected by the
cts:query. That is, the words do not need
to match the query, but the words must occur in fragments that match
the query.
|
|
Usage Notes:
If the options parameter contains neither "ascending" nor "descending",
then the default is "ascending".
At most one of "any", "document", "properties", or "locks"
may be specified in the options parameter.
If the options parameter contains none of "any", "document",
"properties", or "locks", then the default is "any".
If the $query parameter is not present, and the current user is assigned
the admin role, no word filtering is performed. Words may be returned that
only appear in deleted fragments not yet expunged by a merge.
To filter deleted words in this case, use a $query parameter.
For example:
cts:and-query( () )
Only words that can be matched with element-word-query are returned.
That is, only words present in immediate text node children of the
specified element as well as any text node children of child elements
defined in the Admin Interface as element-word-query-throughs or
phrase-throughs.
|
Example:
cts:element-words(xs:QName("animal"),"aardvark")
=> ("aardvark","aardvarks","aardwolf",...)
|
|
|
|
cts:highlight(
|
|
$node as node(),
|
|
$query as cts:query,
|
|
$expr as item()*
|
| ) as node() |
|
 |
Summary:
Returns a copy of the node, replacing any text matching the query
with the specified expression. You can use this function
to easily highlight any text found in a query. Unlike
fn:replace and other XQuery string functions that match
literal text, cts:highlight matches every term that
matches the search, including stemmed matches or matches with
different capitalization.
|
Parameters:
$node
:
The node to highlight. The node must be either a document node
or an element node; it cannot be a text node.
|
$query
:
The query specifying the text to highlight.
|
$expr
:
The expression with which to replace each match. You can use the
variables $cts:text, $cts:node, and
$cts:queries (described below)
in the expression.
|
|
Usage Notes:
There are three built-in variables to represent a query match.
These variables can be used inline in the the expression parameter.
$cts:text as xs:string
- the matched text
$cts:node as text()
- the node containing the matched text
$cts:queries as cts:query*
- the matching queries
You cannot use cts:highlight to highlight results from
cts:similar-query and cts:element-attribute-*-query
items. Using cts:highlight with these queries will
return the nodes without any highlighting.
You can also use cts:highlight as a general search
and replace function. The specified expression will replace any matching
text. For example, you could replace the word "hello" with "goodbye"
in a query similar to the following:
cts:highlight($node, "hello", "goodbye")
Because the expressions can be any XQuery expression, they can be very
simple like the above example or they can be extremely complex.
|
Example:
To highlight "MarkLogic" with bold in the following paragraph:
let $x := <p>MarkLogic Server is an enterprise-class
database specifically built for content.</p>
return
cts:highlight($x, "MarkLogic", <b>{$cts:text}</b>)
Returns:
<p><b>MarkLogic</b> Server is an enterprise-class
database specifically built for content.</p>
|
Example:
Given the following document with the URI "hellogoodbye.xml":
<root>
<a>It starts with hello and ends with goodbye.</a>
</root>
The following query will highlight the word "hello" in
blue, and everything else in red.
cts:highlight(doc("hellogoodbye.xml"),
cts:and-query((cts:word-query("hello"),
cts:word-query("goodbye"))),
if ( cts:word-query-text($cts:queries) eq "hello" )
then ( <font color="blue">{$cts:text}</font> )
else ( <font color="red">{$cts:text}</font> )
)
returns:
<root>
<a>It starts with <font color="blue">hello</font>
and ends with <font color="red">goodbye</font>.</a>
</root>
|
Example:
for $x in cts:search(collection(), "MarkLogic")
return
cts:highlight($x, "MarkLogic", <b>{$cts:text}</b>)
returns all of the nodes that contain "MarkLogic",
placing bold markup around the matched words.
|
|
|