-4

Using following 2 MarkLogic Xqueries inorder to get expected result:

  1. To list out all documents by timestamp

    for $x in xdmp:document-properties()//prop:last-modified  
    order by $x descending 
    return <uri>{xdmp:node-uri($x)} {$x}</uri>
    
  2. To search string in the document from the lastest file

    for $a in doc("/contentC:/MLDemo/DataFiles/1234.xml")/*//@System_Name
    where $a ="Exchange"
    return $a
    

I am new to Marklogic and Xquery. Can someone plesae help me To combine these two individual scripts into one script.

Thanks in advance.

4

4 回答 4

1

假设您没有更改默认配置,prop:last-modified应该会有所帮助。

请参阅https://docs.marklogic.com/guide/app-dev/properties以了解有关属性的更多信息。

请注意,/*//@System_Name where $a ="Exchange"对于大型数据库,这不会很好地执行。指定一个元素并使用 XPath 谓词。尝试更多类似的东西/a/b/c[@d eq $value]- 或者如果你有多个元素/a/b/(c|d|e)[@z eq $value]

于 2012-02-21T03:02:58.290 回答
1

let $URI:=<uris>{ for $x in xdmp:document-properties()//prop:last-modified
order by $x descending return <uri>{xdmp:base-uri($x)}</uri> }</uris>

for $a in $URI//uri let $doc:= doc($a)/*//@System_Name where $a ="Exchange" return $a

于 2015-03-13T10:57:24.893 回答
0

这个问题有很多答案。

我建议您学习基本的 XQuery 语法。例如,尝试http://www.amazon.com/XQuery-Priscilla-Walmsley/dp/0596006349

于 2012-02-20T17:29:21.937 回答
-1
for $a in doc("/contentC:/MLDemo/DataFiles/1234.xml")/*//@System_Name
return 
if($a eq "Exchange") then
       for $x in xdmp:document-properties()//prop:last-modified  
       order by $x descending 
       return <uri>{xdmp:node-uri($x)} {$x}</uri>
else ()
于 2015-02-24T09:24:59.790 回答