[MarkLogic Dev General] element search question

Jonathan Cook - FM&T Jonathan.Cook2 at bbc.co.uk
Sat Mar 10 13:13:52 PST 2012


Bit later than planned but I've written up a post about the tuning work I undertook and the steps I took with some useful links:

Hope it might be helpful for some.


-----Original Message-----
From: general-bounces at developer.marklogic.com on behalf of Geert Josten
Sent: Tue 07.02.2012 06:53
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] element search question
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..



Van: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.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:

<b>any text</b>
<b>any text</b>

Now, I want to search /root[a/b = 'value'] by cts constructors, for example:

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?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20120310/6705dc54/attachment.html 

More information about the General mailing list