HI. A few things. Regarding size, instead of splitting it, you also have the options of fragment roots, for example.
However, regardless of single documents, multiple documents or a fragmented document, your example is still iterating over all occurrences of your 'str' element. By using indexes and MarkLogic's search capabilities, then you isolate the fragments that match completely from indexes and do not end up iterating over the entire document(s) Kind Regards, David Ennis David Ennis *Content Engineer* [image: HintTech] <http://www.hinttech.com/> Mastering the value of content creative | technology | content Delftechpark 37i 2628 XJ Delft The Netherlands T: +31 88 268 25 00 M: +31 63 091 72 80 [image: http://www.hinttech.com] <http://www.hinttech.com> <https://twitter.com/HintTech> <http://www.facebook.com/HintTech> <http://www.linkedin.com/company/HintTech> On 6 January 2015 at 19:51, Ray Bednar <[email protected]> wrote: > > > I have a marklogic database document that is 50 megs and my query below > > xquery version "1.0-ml"; > for $m in > doc("/dlap/angel.bfwpub.com.xml")//response//results//result//doc//arr/str > where fn:contains(fn:string-join(($m/text()), ""), " > http://angel.bfwpub.com") > return > > <results> { $m/../../@entityid } { $m/../../@itemid } {$m/../@name > } {$m } </results> > > kept returning with a pop up in the query console of a script on this page > may be busy and would not process all the results until the browser froze > completely. > > I wrote a utility to break the 50 meg xml document into 50 approximately 1 > meg documents. > > I gave the resulting documents the same file name with an interger > appended starting at 0 up to 49. > I created the following xquery with a function > > xquery version "1.0-ml"; > > > declare function local:stuff ($word as xs:int , $s as xs:string) > { > let $a := fn:concat("DLAP/angel.bfwpub.com", $word, ".xml") > for $m in doc($a)//doc//arr/str > where fn:contains(fn:string-join(($m/text()), ""), $s) > return > > <results> { $m/../../@entityid } { $m/../../@itemid } {$m/../@name > } {$m } </results> > > }; > for $f in (0 to 49) (: 49 :) > return local:stuff($f,"http://angel.bfwpub.com") > > I got the same problem as before. By breaking it down into chunks of 5 > e.g. for $f in (0 to 4) > and capturing the results and then continuing with for $f in (5 to 9) I > was able to get all the results that I needed. > I have some other documents which are much larger so my manual process > maybe too time consuming or error prone. Does anyone have a better > solution. any information will be greatly appreciated. > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
