You might want to look at field queries. They allow you to define which 
elements to include and exclude within a defined fragment. You can also weight 
each included element.

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of David Scott Gurney
Sent: Tuesday, July 20, 2010 3:14 PM
To: [email protected]
Subject: [MarkLogic Dev General] Excluding a node from search

Is there a way to exclude specific nodes from a search using search:search?  I 
need to be able to search documents, but exclude a particular element (and 
every other node within that element) from the search.

I have tried adding an additional query in the search options as shown below:

<additional-query>
                        {
                        cts:not-query( cts:element-query(xs:QName("tei:note"), 
"*") )
                        }
</additional-query>

but this ends up excluding all documents that contain tei:note elements.

Here is a simple example to further illustrate what I'm trying to accomplish.

Given the xml below:

<first>First element
    <second>Second element</second>
      <excludeMe>Exclude element</excludeMe>
    </second>
</first

I want to search for the string "element" and only find the first and second 
element text nodes.  The <excludeMe> node should be absent from the search 
results.


What else can I try?

Thanks
David


 NOTICE: This email message is for the sole use of the intended recipient(s) 
and may contain confidential and privileged information. Any unauthorized 
review, use, disclosure or distribution is prohibited. If you are not the 
intended recipient, please contact the sender by reply email and destroy all 
copies of the original message.


_______________________________________________
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