Added 'multiple' operator to allow complex criteria matching on payload items#5482
Added 'multiple' operator to allow complex criteria matching on payload items#5482arm4b merged 4 commits intoStackStorm:masterfrom
Conversation
|
@armab, @nzlosh ,@cognifloyd |
|
@armab , @nzlosh , @cognifloyd |
There was a problem hiding this comment.
This will make the search operator much more useable. Thanks!
The multiple name is my only hangup with this. I like the idea of adding this functionality to search as it will make it much more useful and useable.
Thanks!
Also, I'll edit the PR description to add closes annotations.
89003aa to
b4f00aa
Compare
arm4b
left a comment
There was a problem hiding this comment.
Thanks for the changes!
Left a couple more comments.
Think about this PR just as adding 2 new criteria.
Please prepare the corresponding documentation for the new criteria in the https://docs.stackstorm.com/rules.html#advanced-comparison so we could merge everything in one go.
Additionally, we'll need a changelog for this PR: https://github.com/StackStorm/st2/blob/master/CHANGELOG.rst
b4f00aa to
c742b2f
Compare
|
I believe I have made all the changes asked of me. Here is a link to the documentation pull request. StackStorm/st2docs#1106 |
cognifloyd
left a comment
There was a problem hiding this comment.
Oh wow. That's a lot simpler. That really helps me to see the diff with search.
Looks fantastic!
arm4b
left a comment
There was a problem hiding this comment.
Thanks, everyone! 👍
Just waiting for st2docs final adjustments to merge this.
|
Docs updated |
The new "multiple" operator is similar to "search" except it adds some additional features. It allows multiple evaluations of the same payload item by a rule. This solves a problem brought up in #2656
Now evaluations such as the following are possible:
In this example the action for this criteria would occur when the latitude and longitude payload data falls outside the area specified, creating a simple box geo-fence.
There are four different criteria conditions:
When specifying payload data in the rule, the "#" symbol and text after it are ignored. This allows dictionary keys to be unique but refer to the same field. Any text can go after the hash.
Using the four different criteria conditions, inclusive or exclusive ranges for the same field are possible.
See tests for more examples.
The multiple operator could eventually replace the search operator.
Closes #2656