Hi Vivek,

You will search through the entire database when you replace doc("/Sample.xml") 
by doc(). The doc() function without arguments returns a node set of *all* 
database documents..

To limit your search to a specific directory you can replace doc() by 
xdmp:directory("/my/directory/", "infinity"), or use cts:and-query to combine 
your existing query with cts:directory-query("/my/directory/", "infinity").

A more elaborate description of the mentioned functions can be found here:
http://developer.marklogic.com/pubs/4.1/apidocs/SequenceBuiltins.html#fn:doc
http://developer.marklogic.com/pubs/4.1/apidocs/Ext-9.html#xdmp:directory
http://developer.marklogic.com/pubs/4.1/apidocs/cts-query.html#cts:directory-query

Kind regards,
Geert

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> Vivek_Nagasundara
> Sent: dinsdag 11 augustus 2009 11:35
> To: General Mark Logic Developer Discussion
> Subject: [MarkLogic Dev General] RE: Multiple Results Retreived
> 
> Hi Geert,
> 
>  
> 
> I tried using cts:search(doc()..) this is helpful when we are 
> searching a particular document for content. But what I'm 
> looking for is something like searching an entire database 
> folder/directory. 
> 
>  
> 
> This is the query I tried using
> 
>  
> 
> for $b in 
> cts:search(doc("/Sample.xml"),cts:or-query((cts:word-query("mo
> bile","wildcarded"),cts:word-query("mobile","case-insensitive")))) 
> 
> return base-uri($b)
> 
>  
> 
> Can you help me out in this
> 
>  
> 
>  
> 
> Regards,
> 
> Vivek N
> 
>  
> 
>  
> 
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> Geert Josten
> Sent: Monday, August 10, 2009 6:00 PM
> To: General Mark Logic Developer Discussion
> Subject: [MarkLogic Dev General] RE: Multiple Results Retreived
> 
>  
> 
> Hi Vivek,
> 
>  
> 
> The cts:search searches in fragments, and selects subelements 
> as expressed in the searchable XPath only afterwards. I 
> recommend using the following expression instead, just for 
> clarity. It is equivalent:
> 
>  
> 
> cts:search(doc(), ...)//para
> 
>  
> 
> If you intend to limit the searching to within the para 
> element, you should use element-query constructors instead.
> 
>  
> 
> HTH..
> 
>  
> 
> Kind regards,
> 
> Geert
> 
>        
> 
>    
> 
>  
> 
> Drs. G.P.H. Josten
> 
> Consultant
> 
>  
> 
>  
> 
> Daidalos BV
> 
> Source of Innovation
> 
> Hoekeindsehof 1-4
> 
> 2665  JZ  Bleiswijk
> 
> Tel.: +31 (0) 10 850 1200
> 
> Fax: +31 (0) 10 850 1199
> 
> www.daidalos.nl <http://www.daidalos.nl/> 
> 
> KvK 27164984
> 
>       
> De informatie - verzonden in of met dit emailbericht - is 
> afkomstig van Daidalos BV en is uitsluitend bestemd voor de 
> geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, 
> verzoeken wij u het te verwijderen. Aan dit bericht kunnen 
> geen rechten worden ontleend.
> 
>  
> 
>       From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> Vivek_Nagasundara
>       Sent: maandag 10 augustus 2009 14:20
>       To: [email protected]
>       Subject: [MarkLogic Dev General] Multiple Results Retreived
> 
>       Hi,
> 
>        
> 
>       I am actually running a search query to retrieve a set 
> of documents from a directory based on a keyword. The query 
> is executed successfully but the result sets are repeating.
> 
>        
> 
>       Here is the query and the results are pasted below.
> 
>       Can you suggest me a method to obtain unique values by 
> avoiding redundancy in the results, I even tried using 
> distinct-nodes() still the same problem persists. 
> 
>        
> 
>        
> 
>       for $x in cts:search(//para, cts:or-query(("from", 
> cts:directory-query(("/book/sports/", "/book/business/"), "1"))))
> 
>       return <a>{base-uri(distinct-nodes($x))}</a> 
> 
>        
> 
>        
> 
>        
> 
>       Search Result:
> 
>        
> 
>        <a>/Book/business/Media story/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/Media story/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/Media story/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/Media story/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/Media story/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/Media story/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/XBox time/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/XBox time/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/XBox time/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/XBox time/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/XBox time/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/XBox time/Rational Software_doc.xml</a> 
> 
>         <a>/Book/business/Fall of Delhi Metro/MainStory_doc.xml</a> 
> 
>         <a>/Book/business/Fall of Delhi Metro/MainStory_doc.xml</a> 
> 
>         <a>/Book/business/Current Scenario/Rational 
> Software_doc.xml</a> 
> 
>         <a>/Book/business/Current Scenario/Rational 
> Software_doc.xml</a> 
> 
>         <a>/Book/business/Current Scenario/Rational 
> Software_doc.xml</a> 
> 
>         <a>/Book/business/Current Scenario/Rational 
> Software_doc.xml</a> 
> 
>         <a>/Book/business/Current Scenario/Rational 
> Software_doc.xml</a> 
> 
>         <a>/Book/business/Current Scenario/Rational 
> Software_doc.xml</a> 
> 
>         <a>/Archives/Rational Software_doc_xhtml.xml</a> 
> 
>         <a>/Archives/Rational Software_doc_xhtml.xml</a> 
> 
>         <a>/Archives/Rational Software_doc_xhtml.xml</a> 
> 
>         <a>/Archives/Rational Software_doc_xhtml.xml</a> 
> 
>         <a>/Archives/Rational Software_doc_xhtml.xml</a> 
> 
>         <a>/Archives/Rational Software_doc_xhtml.xml</a>  
> 
>                         
> 
>        
> 
>        
> 
>       Regards,
> 
>       Vivek N
> 
>        
> 
>        
> 
>        
> 
>       
> ________________________________
> 
> 
>       DISCLAIMER:
>       This email (including any attachments) is intended for 
> the sole use of the intended recipient/s and may contain 
> material that is CONFIDENTIAL AND PRIVATE COMPANY 
> INFORMATION. Any review or reliance by others or copying or 
> distribution or forwarding of any or all of the contents in 
> this message is STRICTLY PROHIBITED. If you are not the 
> intended recipient, please contact the sender by email and 
> delete all copies; your cooperation in this regard is appreciated.
> 
>  
> 
> 
> ________________________________
> 
> DISCLAIMER:
> This email (including any attachments) is intended for the 
> sole use of the intended recipient/s and may contain material 
> that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any 
> review or reliance by others or copying or distribution or 
> forwarding of any or all of the contents in this message is 
> STRICTLY PROHIBITED. If you are not the intended recipient, 
> please contact the sender by email and delete all copies; 
> your cooperation in this regard is appreciated.
> 
> _______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to