Hello Charles, Thanks for reply...
Charles if I will create a document for each keyword then again it becomes same problem as I facing with current solution. Any other way to short out this problem from ML side. Thanks, Varun On Thu, Mar 7, 2013 at 12:53 AM, Charles Greer <cgr...@marklogic.com> wrote: > Hi Varun, > > With reverse-query what you want to do is actually store the cts:query of > interest within a document. The query has to be serializable. Then > reverse query will return the document which contains a query that matches > doc.xml. > > So typically, you'd create a separate document for each keyword, which > would look something like: > > <query> > <cts:word-query xmlns:cts="http://marklogic.com/cts"> > <cts:text xml:lang="en"> > varunesh...@gmail.com > </cts:text> > </cts:word-query> > </query> > > I made this by evaluating > <query>{cts:word-query("varunesh...@gmail.com" <varunesh...@gmail.com> > )}</query> > > Then, when I run something like > cts:search(/, cts:reverse-query(<doc>My name is varunesh...@gmail.com > </doc>)) > > then the stored <query> doc above is returned. > > Charles > > > On 03/06/2013 10:18 AM, Varun Varunesh wrote: > > Hello All, > As I want to create an alert API. In which I am using two xml files say > user_id.xml and doc.xml . > > The format of user_id.xml is like this > <data> > <keyword name="MarkLogic"> > <mail>varunesh...@gmail.com</mail> > <mail>var...@gmail.com</mail> > <mail>v...@gmail.com</mail> > <mail>sa...@gmail.com</mail> > </keyword> > <keyword name="google"> > ......... > ......... > </keyword> > </data> > > Another file doc.xml contains all the recent document name inserted into my > ML database. > > Now, for each new document (those are present in doc.xml ) I want to do a > reverse query on the user_id.xml so that If the new document contains the > keyword(which is in user_id.xml) > then mail can be send to all the email-id under that keyword. > > Right now I have implemented this using simple search method which for each > document and for each keyword I am applying cts:contains and if it returns > true then I am sending mails > to all the emails under that keyword. > But this method will not work if we have large set of keywords with huge > no. of users. > > So, suggest me how can I use cts:reverse-query to implements this. > > Thanks. > > > > > _______________________________________________ > General mailing > listGeneral@developer.marklogic.comhttp://developer.marklogic.com/mailman/listinfo/general > > > -- > Charles Greer > Senior Engineer > MarkLogic corporationcharles.gr...@marklogic.com > Phone: +1 707 408 3277www.marklogic.com > > > _______________________________________________ > General mailing list > General@developer.marklogic.com > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list General@developer.marklogic.com http://developer.marklogic.com/mailman/listinfo/general