search: add concat behavior for Standard search
Created by: rvantonder
This makes patterntype:standard
"work" (RFC 675). Now you can write /.../
for regexp pattern, or alternatively literal patterns (they keep working the same way), or you can alternate them. Just going to copy the docstring to explain the behavior:
standard reduces a sequence of Patterns such that:
adjacent literal patterns are concattenated with space. I.e., contiguous literal patterns are joined on space to create one literal pattern.
any patterns adjacent to regular expression patterns are AND-ed.
Here are concrete examples of input strings and equivalent transformation. I'm using the
content
field for literal patterns to explicitly delineate how those are processed.
/foo/ /bar/ baz
->(/foo/ AND /bar/ AND content:"baz")
/foo/ bar baz
->(/foo/ AND content:"bar baz")
/foo/ bar /baz/
->(/foo/ AND content:"bar" AND /baz/)
Next:
-
the frontend doesn't understand any of this new
patterntype:standard
business, but once that's hooked up this behavior will kick in. -
remaining backend changes is to bump the query version to V3 and use this interpretation by default going forward
Test plan
Added tests. At some point I will look into make these less verbose but right now the verbosity is OK.