It' ok,

        But when i tried the same i got some exception.

cts:search(doc(), $ctsQuery )[number(.//priority) eq  
number(.//eligible-flag)]

<error:code>XDMP-ARGTYPE</error:code> 
  <error:name>err:XPTY0004</error:name> 
  <error:message>Invalid argument type</error:message> 

I don't know what is the problem.

Santhosh Rajasekaran
Tata Consultancy Services
Mailto: [email protected]
Website: http://www.tcs.com
____________________________________________
Experience certainty.   IT Services
                        Business Solutions
                        Outsourcing
____________________________________________



deepak mohan <[email protected]> 
Sent by: [email protected]
05/06/2009 03:21 PM
Please respond to
General Mark Logic Developer Discussion <[email protected]>


To
General Mark Logic Developer Discussion <[email protected]>
cc

Subject
Re: [MarkLogic Dev General] [email protected]








Thank you very much Santhosh.

I prefer cts:query because the search may cross 100000 fragments and the 
flower will bring the node in-memory for every iteration..

Geert suggested:

cts:search(doc(), $ctsQuery )[number(.//priority) eq  
number(.//eligible-flag)]

and it works better in my case.
Please correct me if I misunderstood anywhere.

thanks and regards,
Deepak M.




--- On Wed, 6/5/09, Santhosh Raj <[email protected]> wrote:

From: Santhosh Raj <[email protected]>
Subject: Re: [MarkLogic Dev General] [email protected]
To: "General Mark Logic Developer Discussion" 
<[email protected]>
Date: Wednesday, 6 May, 2009, 2:53 PM


HI deepak, 

If this is your xml file isteard of node1 and node2 and etc., You can 
chage it to a common tag called node. 

        xdmp:document-insert("mohan.xml", 
    <nodes> 
      <node> 
             <priority>1</priority> 
             <eligible-flag>1</eligible-flag> 
      </node> 
      <node> 
             <priority>2</priority> 
             <eligible-flag>2</eligible-flag> 
      </node> 
      <node> 
             <priority>2</priority> 
             <eligible-flag>0</eligible-flag> 
      </node> 
     </nodes>) 

then you can user normal flower expression to get the nodes, without 
cts:search function you can get the particular nodes which is matching the 
criteria . i.e ( priority value = eligible-flag value) 


xquery is : 

<nodes> 
{ 
  for $x in doc("mohan.xml")//node 
  where $x/priority = $x/eligible-flag 
  return $x 
} 
</nodes> 

Note: 

If you know the uri of the file than give that in the doc("mohan.xml") 
function, 

 Even if you don't know  the file name then simply use doc() still it will 
return the same result. (basically it will search for all the files 
matching the given criteria.) 

<nodes> 
{ 
  for $x in doc( )//node 
  where $x/priority = $x/eligible-flag 
  return $x 
} 
</nodes> 


output: 

 <nodes> 
 <node> 
               
  <priority>1</priority> 
               
  <eligible-flag>1</eligible-flag> 
         
  </node> 
 <node> 
               
  <priority>2</priority> 
               
  <eligible-flag>2</eligible-flag> 
         
  </node> 
  </nodes> 



Regards,
Santhosh Rajasekaran




deepak mohan <[email protected]> 
Sent by: [email protected] 
05/06/2009 01:49 PM 


Please respond to
General Mark Logic Developer Discussion <[email protected]>


To
[email protected] 
cc

Subject
[MarkLogic Dev General] [email protected]










Hi Chaps, 

     I want to search for a node based on the comparision of values within 
the node. Could you please send me a cts:query for the above critertia. 

for eg: The node looks like this: 
           
      <node1> 
             <priority>1</priority> 
             <eligible-flag>1</eligible-flag> 
      </node1> 
      <node2> 
             <priority>2</priority> 
             <eligible-flag>2</eligible-flag> 
      </node2> 
      <node3> 
             <priority>2</priority> 
             <eligible-flag>0</eligible-flag> 
      </node3> 

I want to select the node if the priority and eligible has the same 
value.... 

thanks in advance, 
Deepak M. 







Now surf faster and smarter ! Check out the new Firefox 3 - Yahoo! Edition 
* Click here!_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

ForwardSourceID:NT0000AE8A     
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you




-----Inline Attachment Follows-----

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

Bollywood news, movie reviews, film trailers and more! Click here.
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

ForwardSourceID:NT0000AEBE 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you


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

Reply via email to