I should probably add that I'm trying to extract all classification
values for the documents that have a specific keyword value.
On Wed, Nov 12, 2008 at 2:40 PM, Steve <[EMAIL PROTECTED]> wrote:
> Thanks for your response.
>
> I've tried your suggestion and it doesn't really help. Looking at the
> profiling document, I can see that it's clearly the XPath on the
> document results that is slowing the who thing down. Is there any
> other ways that I can improve this. I've included a sample document
> (small), so you can see what I'm trying to achieve.
>
> <doc>
> <classifications>
> <classification value="123" />
> <classification value="324" />
> </classifications>
> <keywords>
> <keyword value="word1" />
> <keyword value="word2" />
>
> </keywords>
> </doc>
>
>
>
> On Wed, Nov 12, 2008 at 2:24 PM, James Clippinger
> <[EMAIL PROTECTED]> 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