This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Commit d0e4376
committed
apply ^github.com optimization for all instances
The purpose of this change is to remove a special-case for Sourcegraph.com.
If a user's query has a repo filter like `repo:github.com/foo`, we rewrite it to `repo:^github.com/foo` (note the `^`). This makes the DB query faster because it only needs to search at the beginning of the string.
This optimization only happens on Sourcegraph.com because technically someone could have a repo at (say) `https://github.com/owner/foo.github.com` or `https://myothercodehost.example.com/foo.github.com/bar`, and they could query `repo:github.com` intending to match one of those. We wanted to avoid that behavior on customer instances. Those are rare edge cases, and the user could work around this rewriting with `repo:.*github.com` if truly needed. We now make this rewriting only occur if there is a trailing slash, which mitigates the (anyway likely zero) impact.
Making this rewriting behavior consistent removes a dotcom edge case and could improve repository search performance for common queries with a tiny hypothetical impact on the behavior.
Note that GitHub Pages repositories are not affected here because those are named `foo.github.io` not `foo.github.com` (https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-github-pages-site#creating-a-repository-for-your-site).1 parent fee9116 commit d0e4376
2 files changed
+1
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
1117 | 1116 | | |
1118 | 1117 | | |
1119 | 1118 | | |
1120 | | - | |
| 1119 | + | |
1121 | 1120 | | |
1122 | 1121 | | |
1123 | 1122 | | |
| |||
0 commit comments