Search: use named search type selector.
Created by: rvantonder
We should use a string type instead of a boolean flag to indicate the search kind (whether regex, literal, or soon, structural). This PR:
-
converts the
isRegexp
flag tosearchType
-
extracts the logic in
pattern_type.go
that overrides the searchType based on thepatterntype
field to the the new functiondetectSearchType
. This function uses the query parser, not regex patterns, to get the field values ofpatterntype
. -
Side effect: separates the
ParseAndCheck
function, because we needParse
to be separately exposed for checkingpatterntype
.
Test plan:
- Updates tests and removes tests for
pattern_type.go
that don't make sense with the new structure (checking, e.g.,patterntype
).