MarkLogic: how to search for an XPath using cts:uris -
is possible search uri document contains xpath using cts:uris()? thought may quicker returning uris cts:search. here have currently:
declare function local:xpath-search($collection) { $i in cts:search(//a/b, cts:and-query((cts:collection-query($collection)) ))[1] return fn:base-uri($i) } ; is there quicker way return documents contain match xpath //a/b, using cts:uris()?
you can use cts:element-query() construct cts:query functions similar xpath expression //a/b searching documents have a elements have b element descendants. isn't same, , might give false positives, because more akin //a//b, might acceptable , can used cts:uris().
xquery version "1.0-ml"; declare function local:xpath-search($collection) { cts:uris("", (), cts:and-query(( cts:collection-query($collection), cts:element-query(xs:qname("a"), cts:element-query(xs:qname("b"), cts:and-query(()) ) ) )) ) };
Comments
Post a Comment