Skip to content

Search: use named search type selector.

Warren Gifford requested to merge rvt/search-type-selector-1 into master

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 to searchType

  • extracts the logic in pattern_type.go that overrides the searchType based on the patterntype field to the the new function detectSearchType. This function uses the query parser, not regex patterns, to get the field values of patterntype.

  • Side effect: separates the ParseAndCheck function, because we need Parse to be separately exposed for checking patterntype.

Test plan:

  • Updates tests and removes tests for pattern_type.go that don't make sense with the new structure (checking, e.g., patterntype).

Merge request reports

Loading