What's meant by a "rooted XPath expression"? Simply absolute/non-relative, or something else/more?

Eric

James Clippinger wrote:
Steve, your query is doing some heavyweight filtering for the XPath
because it is doing two steps:

1) Execute the cts:search(): generate a list of all documents matching
the query in relevance order.

2) Execute the XPath: reorder the documents into document order and find
only those with /doc/classifications/classification elements, returning
those classification elements.

Since you are using XPath and thus returning results in document order,
you probably want to use cts:contains() in an XPath predicate rather
than cts:search().  cts:contains() in a rooted XPath expression will use
the search indexes when appropriate, so it's as fast as the equivalent
cts:search() expression.  Try this:

let $search := cts:element-attribute-word-query(fn:QName("", "keyword"),
fn:QName("", "value"), "something")
return fn:collection()/doc[cts:contains(.,
$search)/classifications/classification

James

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve
Sent: Wednesday, November 12, 2008 8:54 AM
To: [email protected]
Subject: [MarkLogic Dev General] Improving XPath Performance on SearchResults

I've written a query which I use to search my data set and I am able to get the results back very quickly. However the results that I get back show the complete document that the search matched, where as I want a particular node returned. At the moment I'm doing this:

let $search := cts:element-attribute-word-query(fn:QName("",
"keyword"), fn:QName("", "value"), "something") let $results := cts:search(fn:collection(), $search)/doc/classifications/classification
   return $results

I've tried profiling this query and I've found that there is a big lag filtering the $results of the search using XPath. Is there any way, either through using a different query or search notation, or by indexes etc that I can speed this up.

Thanks in advance...
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general


------------------------------------------------------------------------

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to