type:repo behaves unpredictably
Created by: rvantonder
Can someone explain why this search results in "too many results?" instead of starting with x number of repositories and displaying data? I've seen this in quite a few sessions lately and users are always surprised.
- borked:
search type:repo
- works:
repo:search
Related to https://github.com/sourcegraph/sourcegraph/issues/15182, where issue was:
Root Cause:
repoSearch returns different results.
Why does repoSearch return a different result? repoSearch matches the pattern against the resolved repositories coming from determineRepos, which returns a different list of repos for the two queries.
Why does determineRepos return a different list? Because of the missing repo filter in sourcegraph type:repo we match the pattern sourcegraph against the list of default (indexed) Repos (200k). In the case of repo:sourcegraph, we match the pattern sourcegraph against the list of all repos (with a configured limit of 500k) in the db.
PR https://github.com/sourcegraph/sourcegraph/pull/16904 that was supposed to help with this but it's not working.
@stefanhengl any objection to me rewriting type:repo foo
queries to repo:foo
? I'm still not sure why these are different, is it only because one set is indexed, and the other not? By rewriting type:repo
, we can interpret these two syntactic variants equivalently internally. In time, we'll have a single type for a repository query, there will be no syntactic distinguish between type:repo foo
, repo:foo
.