Search: lift out searcher callout in frontend.
Created by: rvantonder
- It's useful to have a generic function that does "run all of these repos through the searcher endpoint", for an arbitrary list of repos.
- Right now, such logic is inlined in
searchFilesinRepos
and only does "run all of these (unindexed repos) through searcher endpoint". - I want to preserve this logic, but also make it possible to "run all of these <repos/files zoekt tells me about> through the searcher endpoint", for structural search.
Such a function cannot be extracted to the top level because it runs goroutines that rely on addMatches
(which seeks to be race safe), and is also inlined. This PR extracts the desired logic into a dedicated inline function callSearcherOverRepos
, which I will use in subsequent diffs to call out to searcher for structural search.
What I need is for Go experts to confirm that what I've done here is semantics preserving and race safe.