Skip to content

search: fallback to literal search if structural search pattern is empty

Created by: rvantonder

In #8312 I fixed some poor usability with structural search to only operate on file contents. This change meant that when the query has an empty pattern, like repo:foo or file:bar, it would always return No results, since those are different result types. This means you have to change to regex or literal mode to do repo or file search when in structural search. No bueno.

This change makes it so that if the pattern is empty in structural search, it falls back to "literal" search (i.e., just do file/repo search as usual).

All this kind of ad-hoc processing on the query with get pulled into the query package (this processing is part of query validation and transformation) and will become more consistent soon.

I've added an e2e regression test for this behavior, since it's hard to test doResults until I've moved things to the query processing.

Merge request reports

Loading