
cts.documentFragmentQuery( query as cts.query ) as cts.documentFragmentQuery
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(
cts.documentFragmentQuery(
cts.wordQuery("hello")));
// All documents that contain the word "hello".
// Assume the database contains the following document with a fragment
// root of <fragment> and URI "fragmented.xml":
//
// <root>
// <author>bob</author>
// <fragment>dog</fragment>
// <fragment>cat</fragment>
// <fragment>fish</fragment>
// </root>
cts.search(
cts.andQuery((
cts.documentFragmentQuery('bob'),
'dog'
))
);
// Matches the 'fragmented.xml' document.
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.