Hi Zise,

  Always use pagination concept to avoid  " XDMP-EXPNTREECACHEFULL". Your first 
query returns only the count of the total result, but the second query returns 
the actual content as result. So, use something start and end values to get 
your result like [show 1 to 100 results].

See the below query ...


cts:search(collection()/patient/link/visit/lab_report[@delete_flag = '0'],

  cts:and-query(

    
(cts:element-attribute-range-query(xs:QName("lab_report"),xs:QName("report_date"),
 ">=", xs:dateTime("2010-09-25T00:00:00.000")),
    
cts:element-attribute-range-query(xs:QName("lab_report"),xs:QName("report_date"),
 "<=", xs:dateTime("2014-09-25T00:00:00.000")))))[1 to 10]

Thanks and regards
Raja >>>

From: [email protected] 
[mailto:[email protected]] On Behalf Of ???
Sent: Thursday, July 02, 2015 2:24 PM
To: [email protected]
Subject: Re: [MarkLogic Dev General] XDMP-EXPNTREECACHEFULL error


I had created range index on delete_flag and report_date, and i change my 
xquery to this:

count(cts:search(collection('test')/patient/link/visit/lab_report[@delete_flag 
= '0'],

  cts:and-query(

    
(cts:element-attribute-range-query(xs:QName("lab_report"),xs:QName("report_date"),
 ">=", xs:dateTime("2010-09-25T00:00:00.000")),

    
cts:element-attribute-range-query(xs:QName("lab_report"),xs:QName("report_date"),
 "<=", xs:dateTime("2014-09-25T00:00:00.000"))))));



and this query can work.



but if i execute the follow xquery, MarkLogic still will throw an 
XDMP-EXPNTREECACHEFULL error:

cts:search(collection()/patient/link/visit/lab_report[@delete_flag = '0'],

  cts:and-query(

    
(cts:element-attribute-range-query(xs:QName("lab_report"),xs:QName("report_date"),
 ">=", xs:dateTime("2010-09-25T00:00:00.000")),

    
cts:element-attribute-range-query(xs:QName("lab_report"),xs:QName("report_date"),
 "<=", xs:dateTime("2014-09-25T00:00:00.000")))));



the above xquery will return a very large resut set, in this case, what can i 
do to avoid the  XDMP-EXPNTREECACHEFULL error





>

>Message: 1

>Date: Wed, 1 Jul 2015 10:58:24 +0530

>From: Indrajeet Verma 
><[email protected]<mailto:[email protected]>>

>Subject: Re: [MarkLogic Dev General] XDMP-EXPNTREECACHEFULL error

>To: MarkLogic Developer Discussion 
><[email protected]<mailto:[email protected]>>

>Message-ID:

>       
> <cakwhaegeh70ro8wgqvmuv3jaqbcmv7u09gnxhnfxmfbv1or...@mail.gmail.com<mailto:cakwhaegeh70ro8wgqvmuv3jaqbcmv7u09gnxhnfxmfbv1or...@mail.gmail.com>>

>Content-Type: text/plain; charset="utf-8"

>

>In Addition of Asit response,

>

>You should go with cts:element-values() and you should create cts:and-query

>and inside it cts:range-query for the dates and flag.

>

>Create range index for lab_report, report_date and delete_flag.

>

>Let me know if you want any help in creating query.

>

>Regards,

>Indy

>

>On Wed, Jul 1, 2015 at 10:45 AM, Asit Nautiyal 
><[email protected]<mailto:[email protected]>>

>wrote:

>

>> Hi Zise,

>>

>> By observing below code, it will hit performance for sure and that's why

>> your are getting XDMP-EXPNTREECACHEFULL error.

>> To avoid XDMP-EXPNTREECACHEFULL error you have to tune your code. Use

>> cts:queries (like range queries and others) to get your result first and

>> then you can use count.

>>

>> Please go through the below link :

>>

>> https://docs.marklogic.com/guide/performance

>>

>>

>> Regards,

>> Asit Nautiyal

>> ------------------------------

>> Date: Wed, 1 Jul 2015 10:11:01 +0800

>> From: [email protected]<mailto:[email protected]>

>> To: [email protected]<mailto:[email protected]>

>> Subject: [MarkLogic Dev General] XDMP-EXPNTREECACHEFULL error

>>

>>

>> when i execute the following xquery , marklogic throw an

>> XDMP-EXPNTREECACHEFULL error:

>> count(for $i in collection('test')/patient/link/visit/lab_report

>> where $i /@report_date >= '2010-09-25T00:00:00.000' and $i/@ report_date

>> <= '2014-09-25T00:00:00.000' and $i/@delete_flag = '0'

>> return $i)

>>

>> I can not increase size of expanded tree cache, so what i can do to avoid

>> the XDMP-EXPNTREECACHEFULL error while the query resturn the very large

>> results

>>

>>

>>

>> _______________________________________________ General mailing list

>> [email protected]<mailto:[email protected]> 
>> Manage your subscription at:

>> http://developer.marklogic.com/mailman/listinfo/general

>>

>> _______________________________________________

>> General mailing list

>> [email protected]<mailto:[email protected]>

>> Manage your subscription at:

>> http://developer.marklogic.com/mailman/listinfo/general

>>

>>

>-------------- next part --------------

>An HTML attachment was scrubbed...

>URL: 
>http://developer.marklogic.com/pipermail/general/attachments/20150701/e5ad4c84/attachment-0001.html

>

>------------------------------

>

>Message: 2

>Date: Wed, 1 Jul 2015 13:46:50 +0000

>From: Dave Cassel <[email protected]<mailto:[email protected]>>

>Subject: Re: [MarkLogic Dev General] how to update the attribute of

>       nodes?

>To: MarkLogic Developer Discussion 
><[email protected]<mailto:[email protected]>>

>Message-ID: 
><d1b93d2e.cca51%[email protected]<mailto:d1b93d2e.cca51%[email protected]>>

>Content-Type: text/plain; charset="us-ascii"

>

>To Asit's point, if you need to make an update like this across a large number 
>of documents, take a look at Corb2<https://github.com/marklogic/corb2>.

>

>--

>Dave Cassel<http://davidcassel.net>, @dmcassel<https://twitter.com/dmcassel>

>Technical Community Manager

>MarkLogic Corporation<http://www.marklogic.com/>

>http://developer.marklogic.com/

>

>

>From: Indrajeet Verma 
><[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>>

>Reply-To: MarkLogic Developer Discussion 
><[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>>

>Date: Wednesday, July 1, 2015 at 1:21 AM

>To: MarkLogic Developer Discussion 
><[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>>

>Subject: Re: [MarkLogic Dev General] how to update the attribute of nodes?

>

>Hi Zise,

>

>You can try below code as well,

>

>xdmp:node-replace(/catalog/product/name/@language, attribute language 
>{"chinese"})

>

>Regards,

>Indy

>

>On Wed, Jul 1, 2015 at 10:37 AM, Asit Nautiyal 
><[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>>
> wrote:

>Hi Zise,

>

>There are various ways to do this simple task. Find the below sample code :

>

>let $doc := fn:doc("/xmlFile.xml")

>let $oldNode := $doc/catalog/product/name[@language="en"]

>let $newNode := element {fn:local-name($oldNode)} { attribute language 
>{"chinese"}, $oldNode/text()}

>

>return xdmp:node-replace($oldNode,$newNode)

>

>Above code will work as expected. But, if your database size is very huge and 
>you want to perform such update on entire database then use cts:queries for 
>better performance.

>

>

>Regards,

>Asit Nautiyal

>

>________________________________

>Date: Wed, 1 Jul 2015 11:50:02 +0800

>From: 
>[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>

>To: 
>[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>

>Subject: [MarkLogic Dev General] how to update the attribute of nodes?

>

>

>the xml document is:

><catalog>

><productdept="ACC">

><number>

>443

></number>

><namelanguage="en">

>Deluxe Travel Bag

></name>

></product>

></catalog>

>

>I want to update the attirbute language of node name to new value, after 
>update operation, the name node is:

><namelanguage="chinese">

>Deluxe Travel Bag

></name>

>

>which function can do this in marklogic 8.0?

>

>

>

>_______________________________________________ General mailing list 
>[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>
> Manage your subscription at: 
>http://developer.marklogic.com/mailman/listinfo/general

>

>_______________________________________________

>General mailing list

>[email protected]<mailto:[email protected]<mailto:[email protected]%3cmailto:[email protected]>>

>Manage your subscription at:

>http://developer.marklogic.com/mailman/listinfo/general

>

>

>-------------- next part --------------

>An HTML attachment was scrubbed...

>URL: 
>http://developer.marklogic.com/pipermail/general/attachments/20150701/0322e450/attachment.html

>

>------------------------------

>

>_______________________________________________

>General mailing list

>[email protected]<mailto:[email protected]>

>Manage your subscription at:

>http://developer.marklogic.com/mailman/listinfo/general

>

>

>End of General Digest, Vol 133, Issue 1

>***************************************

This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to