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-queryxmlns:cts="http://marklogic.com/cts">
<cts:textxml:lang="en">
[email protected]
</cts:text>
</cts:word-query>
</query>
I made this by evaluating
<query>{cts:word-query("[email protected]")}</query>
Then, when I run something like
cts:search(/, cts:reverse-query(<doc>My name is
[email protected]</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>[email protected]</mail>
<mail>[email protected]</mail>
<mail>[email protected]</mail>
<mail>[email protected]</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 list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
--
Charles Greer
Senior Engineer
MarkLogic Corporation
[email protected]
Phone: +1 707 408 3277
www.marklogic.com
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general