Search code examples
xquerymarklogic

MarkLogic Server Crashing - I Think Too Many Records Are Being Returned


I've written an XQuery that doesn't return using the CQ web application.

I thought the below would work, but the server still hangs.

declare namespace data = "http://marklogic.com/ps/data";
/data:doc/data:provider[ 1 to 5 ]

Any ideas? It doesn't hang if I search down the tree. I am trying to explore the data structures at this point so I need at least one provider returned.

Thanks-in-advance,

Guido


Solution

  • I think you need parenthesis around your XPath steps. I think you have asked the server to load up all of the /data:doc/data:provider elements. Sort them in document order and then, grab the first 5. But if you have millions or billions of those elements, it will have to get them all. Which is probably taking a long time. Try this instead:

    declare namespace data = "http://marklogic.com/ps/data";
    (/data:doc/data:provider)[ 1 to 5 ]
    

    -Danny