
alert:make-rule( $name as xs:string, $description as xs:string, $user-id as xs:unsignedLong, $query as cts:query, $action as xs:string, $options as element(alert:options) ) as element(alert:rule)
This function creates the specified rule. 
		  If the caller does not have the alert-admin
		  privilege then $user-id must be the ID
		  of the current user from the security database.  
		  If $user-id is 0, it will be automatically 
		  replaced with the current user's ID.
  xquery version "1.0-ml";
  import module namespace alert = "http://marklogic.com/xdmp/alert" 
		  at "/MarkLogic/alert.xqy";
  alert:make-rule(
    "nucleic acids email", 
    "Alert me to anything concerning nucleic acids",
    0, 
    cts:or-query((
        cts:word-query("dna"),
        cts:word-query("rna")
       )),
    "email",
    <alert:options>
        <alert:email-address>me@somedomain.com</alert:email-address>
    </alert:options>
  )
  
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.