Closed rvantonder closed 3 years ago
Heads up @lguychard - the "team/search" label was applied to this issue.
So, it appears that Zoekt only supports searching by branch name, not by commit. In the request to searcher, the branch names has already been resolved fully to a commit hash, which we can't use to query Zoekt. Any ideas on how to resolve this?
CC @keegancsmith. Off-the-cuff thought: we send the branch to searcher if that's our only option?
Searcher client in textsearch.go
should have access to the branch already (part of RepositoryRevision structure). By only sending the branch you avoid the need to resolve the commit (ie call gitserver) which makes this more scaleable. So you actually want to do that. See zoektIndexedRepos
function for how we do it in the literal/regexp search path.
However, we can update Zoekt to do matching on "versions" (SHAs). But for scaleability this isn't needed and we should rely on branch name to avoid gitserver interactions. To support versions in zoekt: We have code like this as part of zoektIndexedRepos
, so something similiar can live in how query.0Branch
is converted into a matchtree: https://sourcegraph.com/github.com/sourcegraph/zoekt@41147eccb798a61e2ed11a737456c5b41cdb1caf/-/blob/matchtree.go?subtree=true#L820-829
In v1 of the searcher-zoekt client #17495, we currently hardcode a repo branch of
HEAD
for searches.We need to make this more general:
I.e., I think we can actually just use
Commit
inapi.CommitID
to pass on branch information. But, from the frontend side, only unindexed repo/commit IDs will be forwarded to searcher currently.