Skip to content
Snippets Groups Projects

search: don't fuzzify repo for GitHub-looking paths

Merged Administrator requested to merge rvt/gh-exact-repo-paths into main

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:

Screen Shot 2020-08-20 at 2 40 42 AM

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).

Merge request reports

Merged by avatar (Jul 4, 2025 7:34pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading