search: don't fuzzify repo for GitHub-looking paths
Created by: rvantonder
The current globbing/wildcard syntax unconditionally fuzzifies repo paths. There are some unavoidable cases where this doesn't behave reasonably for results. The main example is, when searching for:
github.com/sourcegraph/sourcegraph auth
there are hits in the exact repo github.com/sourcegraph/sourcegraph
, but due to the order and nondeterminism that we search repositories (and return results quickly), you will see results for auth
in repos other than github.com/sourcegraph/sourcegraph
first:
So that we can go ahead with our user testing, this PR recognizes GH-like paths like github.com/foo/bar
for repos and then does not fuzzify them. This gives us behavior that is similar to what we did for rev
and what @keegancsmith mentioned in https://github.com/sourcegraph/sourcegraph/issues/12892#issuecomment-672410403. Note: I am choosing a method that has the smallest footprint of changes to get the desired result, not necessarily the most ideal. I played around with attempts that try to resolve the exact repo first, but it won't work well from a UX POV for other reasons. When search expressions are enabled, there is another route, by expressing the search as repo:^exact-attempt$ or repo:fuzzy-attempt
, but that's not possible right now and also imposes other things like ordering how expression are evaluated. I think the hardcoded github
case works fine for now for practical/testing/feedback purposes.
Obviously this means that GH-like paths that don't match an exact repo won't give results--here, a user needs to add explicit *
syntax. I think this is a totally fair compromise (we can certainly do better to propose such queries, e.g., no repo resolved).