File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -215,9 +215,19 @@ type Request interface {
215215type OutputEventCallback func (result * output.InternalWrappedEvent )
216216
217217func MakeDefaultResultEvent (request Request , wrapped * output.InternalWrappedEvent ) []* output.ResultEvent {
218+ // Note: operator result is generated if something was succesfull match/extract/dynamic-extract
219+ // but results should not be generated if
220+ // 1. no match was found and some dynamic values were extracted
221+ // 2. if something was extracted (matchers exist but no match was found)
218222 if len (wrapped .OperatorsResult .DynamicValues ) > 0 && ! wrapped .OperatorsResult .Matched {
219223 return nil
220224 }
225+ // check if something was extracted (except dynamic values)
226+ extracted := len (wrapped .OperatorsResult .Extracts ) > 0 || len (wrapped .OperatorsResult .OutputExtracts ) > 0
227+ if extracted && len (wrapped .OperatorsResult .Operators .Matchers ) > 0 && ! wrapped .OperatorsResult .Matched {
228+ // if extracted and matchers exist but no match was found then don't generate result
229+ return nil
230+ }
221231
222232 results := make ([]* output.ResultEvent , 0 , len (wrapped .OperatorsResult .Matches )+ 1 )
223233
You can’t perform that action at this time.
0 commit comments