Hi Stéphane,

> > 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.
>
> The point is that the insert code in within a java
> application, calling MarkLogic through XDBC connector.
> I don't want this feature being apply everywhere but for this
> case, so I though that the trigger approach was smart.
>
> Maybe it's a bad parallel but it's a feature really easy to
> achieve with a stockproc (that I see like trigger in nosql
> world) because we have an access to OLD and NEW value. So I
> miss something equivalent.
>
> Let me know if my comprehension is confusede.

I guess the easiest way out here is to have a separate upload directory. You 
will need to scope the trigger to that folder only. The trigger (you could use 
the Content Processing Framework too by the way, which in the end is based on 
triggers as well) will then compare the document in the upload folder with the 
document at its proper location and only move it if it really changed.

It is possible though to apply the code mentioned by Kelly from Java through 
XDBC too, by the way. You will need the adHocQuery from XCC, with which you can 
execute any Xquery code you like. You can do the insert with the adhoc query, 
or determine whether to upload with it first.

My first suggestion requires no knowledge in Java, like was you intention I 
think.

Kind regards,
Geert



drs. G.P.H. (Geert) Josten
Consultant

Daidalos BV
Hoekeindsehof 1-4
2665 JZ Bleiswijk

T +31 (0)10 850 1200
F +31 (0)10 850 1199

mailto:[email protected]
http://www.daidalos.nl/

KvK 27164984


De informatie - verzonden in of met dit e-mailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.

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

Reply via email to