Thanks for the suggestion Indrajeet. From: Indrajeet Verma <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Thursday, April 9, 2015 at 3:30 AM To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Subject: Re: [MarkLogic Dev General] last inserted or modified document
Sudhakar, I saw a very useful code by using built in xdmp:document index if you create file name in sequence. Please see the link that Asit shared with you. However I am not sure if this will be fit in you requirement. Code looks like, This code is written by jimfuller2012<https://disqus.com/by/jimfuller2012/> let $startVal := "/restaurant/115.xml" let $endVal := "/restaurant/121.xml" return cts:uris( $startVal, ("document","item-order"), cts:and-query(( cts:directory-query("/", "infinity"), cts:element-range-query( xs:QName("xdmp:document"), "<=", $endVal, "collation=http://marklogic.com/collation...<http://marklogic.com/collation/codepoint>") )) ) I see cts:uri-match() also very useful by using bulit-in index. However I would recommend you to use/create date-modified in your data model for individual document and use cts:query() inside cts:uri() or cts:uri-match() to get latest document without enabling uri-lexicon and creating extra range index if possible. Though if you have already date-modified element in your data model, creating range index for this will help to improve performance. On Thu, Apr 9, 2015 at 1:03 PM, Sudhakar Reddy <[email protected]<mailto:[email protected]>> wrote: Thanks Asit. I’ll try that. From: Asitmohan Nautiyal <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Thursday, April 9, 2015 at 12:17 AM To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Subject: Re: [MarkLogic Dev General] last inserted or modified document Hi Sudhakar, Yes, You can get is very easily. You can use cts:uris() function and inside the function( as third argument) you can use element-value-query for element “prop:last-modified” with your value. NOTE : This function requires the uri-lexicon database configuration parameter to be enabled and also create range index for prop:last-modified for great performance. Please refer https://docs.marklogic.com/cts:uris?q=cts:uris&v=8.0&api=true Regards, Asit Nautiyal From:[email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Sudhakar Reddy Sent: 09 April 2015 12:35 To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] last inserted or modified document Hi, Is there a straight forward way to get the document URI of the last document that was inserted or modified? Thanks Sudhakarprop:last-modified ::DISCLAIMER:: ---------------------------------------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects. ---------------------------------------------------------------------------------------------------------------------------------------------------- _______________________________________________ General mailing list [email protected]<mailto:[email protected]> Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
