This page was generated
August  8,  2011
2:23  AM
XQuery Built-In and Modules Function Reference

Built-In: Extension - Search Functions

The search extension functions complement the Search Built-in functions.

Function Summary
xdmp:diacritic-less Returns the specified string, converting all of the characters with diacritics to characters without diacritics.
xdmp:estimate Returns the number of fragments selected by an expression.
xdmp:exists Returns true if any fragment is selected by an expression, false if no fragments are selected.
xdmp:request-timestamp Returns the system timestamp for this request if the request is a query statement.
Function Detail
xdmp:diacritic-less(
$string as xs:string
)  as   xs:string
Summary:

Returns the specified string, converting all of the characters with diacritics to characters without diacritics.

Parameters:
$string : The string to convert.

Example:
xdmp:diacritic-less("José")
=> Jose 

xdmp:estimate(
$expression as item()*,
[$maximum as xs:double?]
)  as   xs:integer
Summary:

Returns the number of fragments selected by an expression. This can be used as a fast estimate of the number of items in a sequence.

Parameters:
$expression : The expression to estimate. This must be a partially searchable XPath expression or a cts:search() expression.
$maximum (optional): The maximum value to return. Stop selecting fragments if this number is reached.

Usage Notes:

Queries that use xdmp:estimate require that the XPath expression searched is partially searchable. A partially searchable XPath expression is one whose first step is searchable. You can use xdmp:query-trace() to determine if a step is searchable. If there are no entries in the xdmp:query-trace() output indicating that the first step is unsearchable, then the expression is partially searchable and you can perform an xdmp:estimate operation on it.

Example:
  xdmp:estimate(collection())
   => 10476

xdmp:exists(
$expression as item()*
)  as   xs:integer
Summary:

Returns true if any fragment is selected by an expression, false if no fragments are selected. This can be used as a fast existence check.

Parameters:
$expression : The expression to check. This must be a partially searchable XPath expression or a cts:search() expression.

Usage Notes:

Queries that use xdmp:exists require that the XPath expression searched is partially searchable. A partially searchable XPath expression is one whose first step is searchable. You can use xdmp:query-trace() to determine if a step is searchable. If there are no entries in the xdmp:query-trace() output indicating that the first step is unsearchable, then the expression is partially searchable and you can perform an xdmp:exists operation on it.

Calling xdmp:exists on an expression is the same as calling xdmp:estimate on the expression with a maximum of 1. For example, the following are equivalent:

     xdmp:exists(cts:search(collection(), "foo"))
     
       is equivalent to:
     
     xs:boolean(xdmp:estimate(cts:search(collection(), "foo"), 1)) 


Example:
  xdmp:exists(collection())
   => true

xdmp:request-timestamp(  ) as  xs:unsignedLong?
Summary:

Returns the system timestamp for this request if the request is a query statement. Returns the empty sequence if the current request is an update statement.

Usage Notes:

The xdmp:request-timestamp function returns the system timestamp that is in effect for current query. This timestamp will remain unchanged for the duration of the query. If you want to get the most recent system timestamp external to the current running context during an update statement (for example, if your query takes a long time to run, and there are other updates occurring in your database while your update statement is running), you can use xdmp:eval to evaluate a separate query statement that returns the system timestamp at the time the xdmp:eval query is evaluated.

Example:
  xdmp:request-timestamp()
   => 1234567