NewSearchString is like NewSeach but handles the special case of matching field names in addition to string values.
(term string, expr Evaluator)
| 155 | // NewSearchString is like NewSeach but handles the special case of matching |
| 156 | // field names in addition to string values. |
| 157 | func NewSearchString(term string, expr Evaluator) Evaluator { |
| 158 | return &searchString{ |
| 159 | term: term, |
| 160 | expr: expr, |
| 161 | fnm: NewFieldNameMatcher(func(b []byte) bool { |
| 162 | return StringContainsFold(byteconv.UnsafeString(b), term) |
| 163 | }), |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | func (s *searchString) Eval(val super.Value) super.Value { |
| 168 | if s.expr != nil { |
no test coverage detected