Hi John,
>From what I understood from it: XPath uses indexes whenever possible, but depends a lot on how well the query optimizer is able to translate your XPath to indexes. Slightly different expressions can give big performance differences. You can investigate that with amongst others xdmp:plan. More material on XPath optimizations is available in this thread: http://marklogic.markmail.org/thread/swmpzuziqvfyqrlt Apart from the optimizations, the index results often need to be filtered to eliminate false positives like matches a/c/b. Using cts only, and making it such that filtering makes no difference, xdmp:estimate returns accurate results.. Cheers, Geert *Van:* [email protected] [mailto:general-bounces@d eveloper.marklogic.com] *Namens *John Zhong *Verzonden:* dinsdag 7 februari 2012 3:53 *Aan:* General MarkLogic Developer Discussion *Onderwerp:* [MarkLogic Dev General] element search question Hi all, I have xmls look like below: <root> <a> <b>any text</b> <c> <b>any text</b> </c> </a> </root> Now, I want to search /root[a/b = 'value'] by cts constructors, for example: cts:element-query(xs:QName("a"), cts:element-value-query(xs:QName("b"), $value) ) But this searches all the b element under /root/a, like /root/a/c/b, so I want to ask if there is any way to ignore the /root/a/c/b using cts constructors? Because I just want to check the /root/a/b. Or I have to use XPath like /root[a/b = 'value']? If so, how is the performance between cts constructors and XPath? Thanks, John
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
