Hi Gary,


You will need a search path that selects fragment root elements if you
 want only fragments to be actually loaded and returned by the cts:search.
Once you have the fragment, you don’t need to do a separate search for the
root of the document, just use fn:root() to get the root of the document.
Not sure, but if you use exact paths to whatever you need from the document
root (e.g. no paths like // !) I expect no additional fragments to be
loaded..



Kind regards,

Geert



*Van:* general-boun...@developer.marklogic.com [mailto:
general-boun...@developer.marklogic.com] *Namens *Gary Larsen
*Verzonden:* maandag 14 november 2011 15:23
*Aan:* 'General MarkLogic Developer Discussion'
*Onderwerp:* Re: [MarkLogic Dev General] XPath performance in
fragementeddocuments



Hi Geert,



Thanks for the reply which has me thinking a bit differently.  Once I find
the target document the query return elements from the root document and
also elements from one of the documents fragments.  So would it be possible
in a separate cts:search(), to return a specific fragment based upon the
document ID (or something) and the filter for the fragment, avoiding the
reconstruction of the entire document?



cts:document-fragment-query() returns the document according to the API
docs.  How can I return just a fragment?



This is part of a project conversion to MarkLogic which is 99.9% complete
(with greatly improved performance), and too late for data refactoring.



Thanks,

gary



*From:* general-boun...@developer.marklogic.com
[mailto:general-boun...@developer.marklogic.com] *On Behalf Of *Geert Josten
*Sent:* Friday, November 11, 2011 2:23 PM
*To:* General MarkLogic Developer Discussion
*Subject:* Re: [MarkLogic Dev General] XPath performance in
fragementeddocuments



Hi Gary,



It might help if you could supply us a bit more of the relevant code, most
importantly the cts search itself, and the return of the for-loop. It would
also help us understand your problem better if you could explain in more
functional terms what you are actually trying to achieve.



But my first impression is that you are more or less right. If $g0data
spans multiple fragments, they are all retrieved, but that will happen
anyhow if you are going to return $detailInfo. If you wouldn’t, but return
AcctPolicy details only, you could use a search expression that would
return them directly. But it depends on your use case whether that would
work.



Apart from all this, you might want to consider splitting your large
documents into small ones each containing only one user info. That would be
more straight-forward in several respects.. (Mike gave an excellent summary
of all important considerations regarding this just yesterday, look here:
http://markmail.org/message/wv5wmrkpgoyuqzq6)



Kind regards,

Geert



*Van:* general-boun...@developer.marklogic.com [mailto:
general-boun...@developer.marklogic.com] *Namens *Gary Larsen
*Verzonden:* vrijdag 11 november 2011 19:14
*Aan:* 'General MarkLogic Developer Discussion'
*Onderwerp:* [MarkLogic Dev General] XPath performance in fragemented
documents



I’m working with a small set of documents (~100) but each one contains 4k
fragments of user info.  The query results need to be grouped by user and
list the documents that match the user info.



Iteration through all the users and matching documents is fairly quick
using cts constraining queries.  It appears the real performance bottleneck
occurs when locating the user info in each matching document using XPath:



{for $detailInfo in $g0data[accountPolicies/AcctPolicy[acctPolicyDisplayPath
= $g0value]]



The fragment root in this case is AcctPolicy.  Is there anything I can do
which would help XPath performance matching to this fragment data element?



My guess is that the entire document is being reconstructed from all the
fragments even though only one fragment will match (probably a wrong guess J
).



Thanks,

gary
_______________________________________________
General mailing list
General@developer.marklogic.com
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to