cts:document-fragment-query( $query as cts:query ) as cts:document-fragment-query
Returns a query that matches all documents where $query
matches
any document fragment. When searching documents, document-properties, or
document-locks, this function provides a
convenient way to additionally constrain the search against any document
fragment.
Parameters | |
---|---|
query | A query to be matched against any document fragment. |
A document fragment query enables you to cross fragment boundaries in an AND query, as shown in the second example below.
cts:search( xdmp:document-properties(), cts:document-fragment-query( cts:word-query("hello"))) (: All properties documents whose corresponding document : (that is, the document at the same URI as the : proerties document) contain the word "hello". :)
xquery version "1.0-ml"; (: Given a document with a fragment root of <fragment> created as follows: xdmp:document-insert("fragmented.xml", <root> <author>bob</author> <fragment>dog</fragment> <fragment>cat</fragment> <fragment>fish</fragment> </root>); :) cts:search(fn:doc("fragmented.xml"), cts:and-query(( cts:document-fragment-query("bob"), "dog" )) ) (: returns the fragmented.xml document :)