I would echo what Kelly is saying, emphasizing the word "equivalent".

XPath has a contract to return things in document order.  cts:search has a 
contract to return things in relevance order.  Depending on what you are doing, 
one can be less work than another (for example, it can create some work to sort 
//foo in document order).   So in some cases, the semantics of XPath can add 
some extra work to the search.

-Danny

-----Original Message-----
From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Kelly Stirman
Sent: Thursday, May 12, 2011 8:59 AM
To: general@developer.marklogic.com
Subject: [MarkLogic Dev General] Why is cts:search so much faster than XPath?

Equivalent XPath and cts:search expressions should perform the same. Can you 
share an example, and what version you are using?

If they are equivalent and there is a performance difference, then there may be 
a bug.

Kelly

Message: 5
Date: Thu, 12 May 2011 09:05:16 -0600
From: "seme...@hotmail.com" <seme...@hotmail.com>
Subject: [MarkLogic Dev General] Why is cts:search so much faster than
        XPath?
To: <general@developer.marklogic.com>
Message-ID: <snt121-w423bd38403eb7f1aded8d5b7...@phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"


I wrote awhile ago that I thought it was usually best to use search:search for 
full text searching, cts:search for node selection out of the db, and XPath for 
node selection within a document. I just ran into a situation that doing the 
same query for nodes in the DB using cts:search was 6 times faster than using 
XPath. 

So what is it about cts:search that makes it so fast? I assume that there are 
optimizations under the covers, but how is cts:search able to gain from the 
optimizations but XPath is not? Just curious.

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

Reply via email to