Loading TOC...

MarkLogic 10 Product Documentation
alert:rule-set-query

alert:rule-set-query(
   $rule as element(alert:rule),
   $query as cts:query
) as element(alert:rule)*

Summary

Set the cts:query corresponding to the rule's query expression.

Parameters
$rule The representation of a rule.
query The cts:query for documents to match on.

Example

xquery version "1.0-ml";

import module namespace alert = "http://marklogic.com/xdmp/alert" 
		  at "/MarkLogic/alert.xqy";

let $rule := 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> )
return 
alert:rule-set-query($rule, 
   cts:word-query("new query for this rule"))
(: changes the cts:query used in the given rule :)
=>
<alert:rule id="15048720352788491261" 
  xmlns:alert="http://marklogic.com/xdmp/alert">
  <alert:name>nucleic acids email</alert:name>
  <alert:description>Alert me to anything concerning 
  nucleic acids</alert:description>
  <alert:user-id>893641342095093063</alert:user-id>
  <alert:query>
    <cts:word-query xmlns:cts="http://marklogic.com/cts">
      <cts:text xml:lang="en">new query for this rule</cts:text>
    </cts:word-query>
  </alert:query>
  <alert:action-name>email</alert:action-name>
  <alert:options>
    <alert:email-address>me@somedomain.com</alert:email-address>
  </alert:options>
</alert:rule>
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.