Hi Damon,
Thank you for the example and interpreting the query-meters. I'll try that when I run into my next question. gary From: [email protected] [mailto:[email protected]] On Behalf Of Damon Feldman Sent: Wednesday, August 31, 2011 9:10 AM To: General MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] using cts:search with fragmented doc Gary, Notice that the semantics are also different. Your first query looks for a match anywhere in the document and returns the lookupInfo. The second search looks for matches inside the lookupInfo element. As for your question - if you have a fragment root or parent and lookupInfo is only one fragment of a much larger document both queries will be optimized to not return the entire document. More importantly, here is how to confirm the behavior: (: must have fragment root on "b" :) xdmp:document-insert("/test/test.xml", <a>aaa<b>bbb</b><b>bb2</b><b>bb2</b><b>bb2</b><b>bb2</b><b>bb2</b><b>bb2</b> </a>) ; cts:search(doc(), "bbb")/test/b, xdmp:query-meters() The first transaction (before the semicolon) inserts a document. The second transaction searches for only the first <b> match and also reports xdmp:query-meters() output which is: [.] <qm:expanded-tree-cache-hits>1</qm:expanded-tree-cache-hits> <qm:expanded-tree-cache-misses>2</qm:expanded-tree-cache-misses> This indicates that 3 fragments total were expanded into full XML format and loaded into tree cache. This means the six "bb2" fragments were not loaded. Best, Damon From: [email protected] [mailto:[email protected]] On Behalf Of Gary Larsen Sent: Wednesday, August 31, 2011 7:13 AM To: 'General MarkLogic Developer Discussion' Subject: [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 [email protected] http://developer.marklogic.com/mailman/listinfo/general
