Hi John, It is hard to comment on the implementation here, as it really depends on how the functions get called.
Do you have a set of detailed steps for which you do not understand the results? Also, keep in mind that you cannot have the admin role and use the dls functions—it is designed for non-admin role users (because users with the admin role can see and update everything). -Danny From: [email protected] [mailto:[email protected]] On Behalf Of John Zhong Sent: Wednesday, November 09, 2011 9:06 AM To: [email protected] Subject: Re: [MarkLogic Dev General] dls functions questions in MarkLogic 4.2 Hi, I want to recall this...or should I contact ML support? On Thu, Nov 3, 2011 at 10:21 PM, John Zhong <[email protected]<mailto:[email protected]>> wrote: Hi all, I have two questions about the dls functions in MarkLogic 4.2-7 (I tried 4.2-3 before, I encountered the same behavior): 1, The first one is the dls:document-insert-and-manage, it supports to add the document into specify collections, but I found the version 1 document has not been added into the collections, while the main document has been added. Then I looked into the source code dls.xqy in MarkLogic install folder/Modules/MarkLogic, starts from line 119, after calling the dls-document-insert to insert the main document, it calls the _document-manage function to add the version document, there are two questions here: a, the function document-insert-version will not be executed at line 1477, because the transaction, the main document has not been committed, so the fn:doc($uri) is empty. So I think this code is not necessary? document-insert-version( $uri,fn:doc($uri), $annotation, $permissions, xdmp:document-get-collections($uri), xdmp:document-get-quality($uri), xdmp:document-forest($uri),fn:true()) b, it calls the function document-insert-version again at line 1437, but also because the transaction, the xdmp:document-get-collections($uri) is empty too, so that is why the version document has not been added into the specify collections. I think we should pass the collections as parameter. document-insert-version( $uri,$element,$annotation,$permissions, xdmp:document-get-collections($uri),xdmp:document-get-quality($uri), xdmp:document-forest($uri),fn:true()) 2, The second one is the dls:document-checkout-update-checkin, it also supports to add the updated document into specify collections, when I wanted to update the document to another collection, I found the main document keeps the old collections, while the version document has been added into the new collections. Then I looked at the same dls.xqy, starts from line 204, it calls the _document-update function at line 1383 to update the document, but it uses the xdmp:document-get-collections($uri) to get the OLD collections, that is why the updated main document keeps the old collections. I think we should use the $collections, which is the new collections. return ( dls-document-insert($uri,$doc,$previous-perms, xdmp:document-get-collections($uri),$quality,$forest-ids) Can someone confirm these? Thank you, John
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
