New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search query with multiple case:yes|no is silently modified #13958
Comments
In the current state: no, this shouldn't be allowed. What you should have gotten was a "Can't process that query" notification :-). I think the reason you didn't is because the web app actually transforms the query based on the presence of But, when #13126 is done, a query like |
Indeed, I can confirm that the backend will reject that raw query, you can see here in the console. So unfortunately the webapp transforms it before it hits the backend validation. There are a couple of ways to resolve this (e.g., I implement an improved webapp parser detects invalid queries), but that doesn't fix the toggle state issue. |
Shower thought: @attfarhan if I add a webapp parser, it would be straightforward to just disable (gray out) the case toggle if we see more than one |
The more involved solution would be to add a UI button per search pattern with case toggles, like:
This UI approach becomes problematic for queries like |
Yeah, this sounds like a good solution for now. If we add a separate page for multi-line editing or something along those lines we could explore more advanced UI, but that seems like it could be quite far down the line. |
Given https://sourcegraph.slack.com/archives/CHEKCRWKV/p1600443200010300 I don't think we will want to add more advanced UI anytime soon, so that simple solution to disable (gray out) the case toggle seems good to me as well. |
Repro:
repo:^github\.com/sourcegraph/sourcegraph$ (Github case:yes) or (organisation case:no)
into the search bar on Sourcegraph.comExpected: the query remains as I typed it in, and
Github
is matched case-sensitively andorganization
is matched case-insensitivelyActual: the query changes (when I press Enter) to
repo:^github\.com/sourcegraph/sourcegraph$ (Github ) or (organisation case:no)
, which is surprising and means my search doesn't do what I expectedI think I know why this happens (because we pull out
case:
tokens and reflect them in the input toggles), but this is still surprising. It also makes a legit use case harder (finding typos*). BTW, I am not sure ifcase:
can even be applied within a parenthetical sub-expression.(Not high priority.)
organisation
is not a typo universally, but from the POV of US English it is. 😄The text was updated successfully, but these errors were encountered: