This repository was archived by the owner on Sep 30, 2024. It is now read-only.
apply ^github.com optimization for all instances #63369
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 torepo:^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.comorhttps://myothercodehost.example.com/foo.github.com/bar, and they could queryrepo:github.comintending 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 withrepo:.*github.comif 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.ionotfoo.github.com(https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-github-pages-site#creating-a-repository-for-your-site).Test plan
CI