Skip to content

search: fetch repo metadata during repo resolution

Warren Gifford requested to merge tl/hydrate-repo-metadata-during-resolution into main

Created by: tbliu98

Currently, we're fetching repo metadata for matches at the API layer, right before returning a streaming search event. This means we're not able to enhance the types in the result package by matching against that metadata during result construction, which means we can't compute match ranges for things like repo description, which means we can't do things like highlight them in the UI (which is the main motivation for this change).

This PR moves fetching repo metadata from frontend into the repos.Resolve() method in the search backend, which makes that metadata available to each search job to populate as a field on each result.Match type. We end up making more db calls, but the tradeoff is that we are now able to work with repo metadata at the job level across the entire search backend.

Sorry for the large number of files changed, doing this required touching a lot of files and it was easier to do it all at once than to try to break it up somehow.

Test plan

Backend integration tests pass Existing unit tests pass Manually verify via traces that metadata is fetched during job execution Manually run a few typical queries to feel good about end user experience being unaffected

Merge request reports

Loading