Skip to content

search: detect patterntype field with new parser

Administrator requested to merge rvt/new-parser-with-patterntype-x into master

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 functions detectSearchType and overrideSearchType
  • overrideSearchType cannot fail, and is the only part that introspects patterntype. It takes a flag to decide how to introspect patterntype (using the new or old method).
  • allow using the new method (visit field) and test it.

Merge request reports

Loading