-
-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added 'multiple' operator to allow complex criteria matching on payload items #5482
Conversation
@armab, @nzlosh ,@cognifloyd |
@armab , @nzlosh , @cognifloyd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! 👍
This looks like an interesting feature cc @m4dcoder.
Added a couple of comments and questions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow. That's a lot simpler. That really helps me to see the diff with search
.
Looks fantastic!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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