Skip to content

search: add new concat behavior for literal and regexp patterns

Warren Gifford requested to merge backend-integration/rvt/standard-concatter into main

Created by: rvantonder

Stacked on https://github.com/sourcegraph/sourcegraph/pull/37802

We need to implement a different Concat processor for standard queries (i.e,. patterntype:standard) see RFC 675.

Currently, literal patterns are concatted with space. regexp patterns are concatted with .*. Now, with standard, there's the possibility of literal and regexp patterns alternating in the input string for the first time, so the Concat behavior will be different. See docstring for new behavior, but basically all patterns are ANDed except for contiguous literal patterns, which will be space, as before.

I'm making the call that AND is is the more intuitive outside of contiguous literal patterns, because unlike literal patterns, regex patterns are explicitly delineated with /.../. For example, it would be a little silly to say /foo/ /bar/ if you prefer to concat those patterns--you would probably (should) prefer to just write /foo bar/.

Test plan

Adds tests.

Merge request reports

Loading