public static void match ( DatabaseClient client ) throws IOException { // create a manager for document search criteria QueryManager queryMgr = client . newQueryManager ( ) ; // specify the search criteria for the documents String criteria = "neighborhoods" ; StringQueryDefinition querydef = queryMgr . newStringDefinition ( ) ; querydef . setCriteria ( criteria ) ; // create a manager for matching rules RuleManager ruleMgr = client . newRuleManager ( ) ; // match the rules against the documents qualified by the criteria RuleDefinitionList matchedRules = ruleMgr . match ( querydef , new RuleDefinitionList ( ) ) ; // iterate over the matched rules Iterator < RuleDefinition > ruleItr = matchedRules . iterator ( ) ; while ( ruleItr . hasNext ( ) ) { RuleDefinition rule = ruleItr . next ( ) ; System . out . println ( "document criteria " + criteria + " matched rule " + rule . getName ( ) + " with metadata " + rule . getMetadata ( ) ) ; } }
match documents against the alert rules