Salut Stephane,

What is the logic for determining that the document has not changed?

I think you could put the logic into your insert. Something like:

if(xdmp:exists(doc($uri))
then 
 if(xdmp:md5($new) ne xdmp:md5(doc($uri)))
 then xdmp:document-insert($uri,$new-doc)
 else ()
else xdmp:document-insert($uri,$new-doc)

That will slow down your loads, but it should be faster than using a trigger.

Kelly

Message: 3
Date: Fri, 1 Oct 2010 15:40:03 +0200
From: Stephane Toussaint <[email protected]>
Subject: [MarkLogic Dev General] Use Trigger to update conditionally a
        document
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1

Hi,

I try to achieve the following action : 

I have a process where documents are inserted in marklogic in batch mode. Some 
document are reinserted without having change (Same uri and same content). I 
don't want those documents to have there last-modified property updated.
To do so I attempt to use pre-commit trigger to compare pre-action document 
content with the current update content.
But as a doc($trgr:uri) return the updated content, I'm not able to retrieve 
the old content.

Is there a way to do this ?
Is there any other solution in MarkLogic to do the same thing ?

Hope to be clear enough for you to give me some help.

Thanks

St?phane
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to