MarkLogic 9 Product Documentation
alert:make-rule

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)

Summary

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.

Parameters
name The name given to the rule.
description A text description of the rule.
user-id The user ID from the security database of the user who will be notified of matches.
query The query that the rule will be matched against for alerting.
action The name of the action to occur upon the matching of the rule.
$options Information specific to the application for the rule.

Example

  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>
  )
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy