Thanks Geert for time and gudance. Regards Rahul Saluja
On Mon, Oct 12, 2009 at 11:13 PM, Geert Josten <[email protected]>wrote: > Hi Rahul, > > I have some other business at the moment, but perhaps I can look into this > more deeply later on. Or perhaps someone else has time to run your scripts > locally? > > There is nothing wrong with the basic idea of sending some identifier as a > request param. You will have to send some ID to be able to update it. So > that is just fine. > > You could argue though that using the node-uri or base-uri is a potential > security risk, in the sense that you are revealing database details that the > outside world doesn't necessarily need to know. And people might send fake > update requests, sending fake uris, when your scripts will be available > world-wide, possibly corrupting all your data in the database, perhaps even > data that is not related to this application, but just happens to reside in > the same database. It would be safer to give each document a unique ID, > using xdmp:random or so, and use that as identifier, and apply some > collection or directory restrictions internally as well. > > But, perhaps keep that as a later concern and try to get your code to work > first. > > About your second question: how to call a function in search-lib.xqy, > import it and use the prefix you specify in the import line. Looks like you > are doing it the right way. > > Kind regards, > Geert > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] On Behalf Of > > Rahul Saluja > > Sent: maandag 12 oktober 2009 19:16 > > To: General Mark Logic Developer Discussion > > Subject: Re: [MarkLogic Dev General] help on updating node > > > > Hi Geert, > > > > I understand what you are saying but in my example i have not > > been trying to search the updated result it's just that after > > running the update program i look into that particular > > document record using cq , i just want my update to perform, > > i may be asking too much but kindly look into > > > > update-main-searchresult.xqy and search for lines > > > > let $book := > > mysearch-lib:find-forUpdate(xdmp:get-request-field("title"),xd > > mp:get-request-field("price")) > > return > > > > <form action="update-write.xqy"> > > <p> > > <input type="hidden" name="calculatedUri" > > value="{(xdmp:node-uri($book))}"/> > > > > my first question is this a right way of finding uri , which > > i know is fine but i want to know your opinion especially on > > passing the calculated Uri in hidden field > > > > so when in update-write.xqy i try to get that value will i > > get it using xdmp:get-request-field("calculatedUri"), > > > > > > and after that my second question is how do i make a call to > > a function present in my search-lib.xqy which does not return > > any value inside body of update-write.xqy as when i do so it > > just comes as body part printing out as text. > > > > > > looking forward to your response. > > regards > > Rahul saluja > > > > > > > > On Mon, Oct 12, 2009 at 10:36 PM, Geert Josten > > <[email protected]> wrote: > > > > > > Hi Rahul, > > > > With just a very brief glance over your attachments, I > > think you are confused by the timestamp mechanism of > > MarkLogic Server. Any transaction works against a particular > > timestamp. This doesn't affect updates, but does affect > > reading actions. You can never read what you update in the > > same transaction. You will either have to do your read > > actions in a sub query (eval with different-transaction > > option), or break your query in two (two pass execution, or a > > semi-colon somewhere in the middle).. > > > > HTH, > > Geert > > > > > > > > > > > Drs. G.P.H. Josten > > Consultant > > > > > > http://www.daidalos.nl/ > > Daidalos BV > > Source of Innovation > > Hoekeindsehof 1-4 > > 2665 JZ Bleiswijk > > Tel.: +31 (0) 10 850 1200 > > Fax: +31 (0) 10 850 1199 > > http://www.daidalos.nl/ > > KvK 27164984 > > De informatie - verzonden in of met dit emailbericht - > > 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. > > > > > > > From: [email protected] > > > [mailto:[email protected]] On Behalf Of > > > Rahul Saluja > > > Sent: maandag 12 oktober 2009 18:26 > > > > > To: General Mark Logic Developer Discussion > > > > > Subject: [MarkLogic Dev General] help on updating node > > > > > > > > hello all, > > > > > > I am trying to update a particular element in an xml document > > > using node-replace api, in the process of it i have been > > > doing couple of things > > > > > > here is the flow after getting the result from search i call > > > another query named update-write.xqy , which in turns call my > > > function to update the data into the database in process of > > > doing so i am not getting any error nor my data is getting > > > updated, i am attaching code for your reference for the same > > > as i don't want this post to be too big . > > > i am thinking culprit is me trying to find uri using > > > > > > <input type="hidden" name="calculatedUri" > > > value="{(xdmp:node-uri($book))}"/> > > > > > > consider starting point as > > > > > > 1)update-main-searchresult.xqy > > > which is calling > > > update-write.xqy on submit action > > > > > > 2) in update-write.xqy i am calling a function written in my > > > another module which is supposed to update the data but call > > > is not reaching there as in browser i can see title of > > > update-main-searchresult.xqy > > > > > > i know its bit messy, but this is first time i amputting my > > > hands on it. > > > > > > > > > please help me. > > > > > > looking forward to your response. > > > > > > regards > > > Rahul > > > > > > > > > > > > _______________________________________________ > > General mailing list > > [email protected] > > http://xqzone.com/mailman/listinfo/general > > > > > > > > _______________________________________________ > General mailing list > [email protected] > http://xqzone.com/mailman/listinfo/general >
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
