search: detect patterntype field with new parser
Created by: rvantonder
Stacked on #12185.
patterntype:...
is a search query parameter that influences how search patterns in the query itself should be parsed. The old method uses a regex to figure this out (since actually trying to scan or parse the query previously may not succeed, because whether it succeeds is dependent on... patterntype
..., even if the parameter syntax is well-formed).
With the new parser, we can use the literal parser variety to always extract patterntype
, because the literal parser cannot fail for well-formed query parameters. With the migration flag, we purely rely on the new parser.
I didn't implement this commit-by-commit, so a verbal breakdown is:
- split
detectSearchType
to two functionsdetectSearchType
andoverrideSearchType
-
overrideSearchType
cannot fail, and is the only part that introspectspatterntype
. It takes a flag to decide how to introspectpatterntype
(using the new or old method). - allow using the new method (visit field) and test it.