Hi Gary,

You don't need to worry. The searchable expression (the first argument to 
cts:search) is evaluated differently within a cts:search call. Instead of just 
evaluating it (actually gathering all data itself), and filtering that result 
after that, MarkLogic Server calculates which fragments are in play, looks up 
fragments ids within indexes to see which match the query , and gathers data 
only after that. It also loads data fragment by fragment. So, if a certain 
fragment is processed and no longer necessary, it is flushed from memory, apart 
from whatever needs to be returned and cannot yet be stream to the response.

MarkLogic Server tries to do the same with XPath expressions as well, but it 
depends how well the optimizer can translate the expression to index lookups..

Kind regards,
Geert

Van: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] Namens Gary Larsen
Verzonden: woensdag 31 augustus 2011 13:13
Aan: 'General MarkLogic Developer Discussion'
Onderwerp: [MarkLogic Dev General] using cts:search with fragmented doc

Hi,

Most of the documents I target with cts:search contain many fragments, but 
those fragments are not usually required in the results.

I've been using doc() as the first argument, but now I'm concerned that doc() 
may be reconstructing the entire document including the fragments:

                cts:search(doc(), $cq, 'unfiltered')/content/lookupInfo

(/content/lookupInfo is not in a fragment)  If so, could I avoid that by using 
this type of syntax:

                cts:search(/content/lookupInfo, $cq, 'unfiltered')

If entire documents are being reconstructed that would quickly eat up expanded 
cache (if I understand correctly).  My guess is that MarkLogic is smart enough 
to avoid this extra work but want to make sure.

Thanks,
gary

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

Reply via email to