Created by: tbliu98
This PR adds code that enables getting match ranges for repo descriptions as part of RepoSearchJob
, which will enable description match highlighting in the web app. This code is currently unused. I plan to actually add this step to RepoSearchJob
after determining the best way to plug this into the web app. At that time, this extra step will only happen if repo:has.description
was included in the original query.
Changes in this PR:
GetRepoDescriptionsByIDs()
method to repoStore
repoDescriptions()
method to RepoSearchJob
GetRepoDescriptionsByIDs()
so we can get repo descriptions and match against them during RepoSearchJob
.descriptionMatchRanges()
method to jobutil/repos.go
[]result.Range
. I'm optimistic we can just treat repo descriptions coming from the database as a single-line string (in other words, Line
on result.Range
will always be zero and we'll just obtain a starting and an ending index for the matched range), but TBD if that will play nice with the web app.Added unit tests. This code is currently not used anywhere.