You can XPath up from your results to the document node:

cts:search(//INFO-OBJ/TITLE, $query)/ancestor::document-node()

This might give you duplicates though, if there is more than one match in a 
document, so you might have to filter those out.

Another idea is to use the nested element-query you said you tried, and then 
filter the results to check to see that your result matches have a TITLE 
ancestor with an INFO-OBJ parent.  You could use cts:highlight to test that.

-Danny 

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Sam Mefford
Sent: Friday, September 17, 2010 4:11 PM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] [email protected]

> You can change the searchable expression (the first arg to cts:search or the 
> <searchable-expression> option in search:search).

Yeah, i thought of those, but neither gives me relevance ranked documents, each 
will return relevance-ranked titles, which isn't what I'm looking for in this 
case.

Sam

Date: Fri, 17 Sep 2010 10:29:42 -0700
From: Danny Sokolsky <[email protected]>
Subject: Re: [MarkLogic Dev General] Support for direct-child queries?
To: General Mark Logic Developer Discussion
        <[email protected]>
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="us-ascii"

You can change the searchable expression (the first arg to cts:search or the 
<searchable-expression> option in search:search).

for example:

cts:search(//INFO-OBJ/TITLE, $query)

-Danny

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Sam Mefford
Sent: Friday, September 17, 2010 10:21 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] Support for direct-child queries?

I have a need to retrieve relevance-ranked documents containing text matching 
in <TITLE> tags that are direct children of <INFO-OBJ> tags.  I'm using 
cts:search to get matching documents in relevance order.  Using 
cts:element-query I can match in TITLE tags that are descendants of INFO-OBJ 
tags, but I see no way to limit the matching only to direct children.  Thus I'm 
matching TITLE tags that are children of descendant TABLE tags, rather than 
only match the direct-child INFO-OBJ/TITLE tags I want.

Any ideas?

Sam Mefford
[email protected]
801-706-9731
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to