Impossible to toggle between lucky and standard search mode
Created by: lguychard
Background
"Lucky search interpretations" are server-side, dynamically computed alternative interpretations, which are run when the original query does not return enough results, and whose results are merged in with the original result set.

Lucky search is built on standard patterntype interpretation, and is activated through using patterntype:lucky
(which is the default). It is still possible to for queries to be interpreted in a way that does not include any results from alternative interpretations, by using patterntype:standard
.
Problem
There are two main problems here:
- If lucky search is the default, and there is no "escape hatch" out of lucky search for users who want their queries not to include lucky search suggestions, Sourcegraph is broken for users whose use case means getting an accurate result count (where "0 results" may be the answer they are looking for, for example in security or compliance use cases)
- Previously saved queries preserve their pattern type value (
literal
,regex
,standard
, etc. We will mappatterntype:literal
queries topatterntype:standard
). This is true for existing saved queries displayed in the users homepage, codemonitors, and any other client that saves patterntype values in the backend and displays them in the client. But this means users visiting such a link will no longer experience lucky search. This means if a user clicks a link that specifies a patterntype, they are going to stay in the webapp with that patterntype (orstandard
if we map to it), and will no longer experience lucky search.
Additional context and constraints
- It would be nice if the user could clear their recent searches to avoid "tricking" themselves into patterntype:standard saved queries, but that's not something in scope here. Users have request to delete saved queries irrespective, so this is a good thing to add at some point.
Open questions
- While the lucky search suggestions widget is a relatively natural place to suggest switching out of lucky search, what is an appropriate place to suggest switching back into lucky search? How do we explain it?
- How do we signal which mode is active, lucky or standard?
- How does this new toggle interact with the existing in-field toggles?