Skip to content

search: highlight repo:has.description match ranges

Warren Gifford requested to merge tl/repo-desc-highlighting-2 into main

Created by: tbliu98

Part of #18374

This PR adds highlighting for ranges in the visible portion of repo descriptions that are matched by repo:has.description.

  • During RepoSearchJob construction, compile any repo:has.description patterns into regexes that match case-insensitively and across newline characters
  • During RepoSearchJob execution, get resolved repositories' descriptions from the database, match them against the list of compiled regexes, and return the matched ranges as the field DescriptionMatches on result.RepoMatch
  • Add field DescriptionMatches to EventRepoMatch and populate it with the values from result.RepoMatch in frontend
  • Add field descriptionMatches to RepositoryMatch interface in the client
  • Use highlightNode to highlight matched ranges in the RepoSearchResult component

Test plan

Unit tests, manual testing. highlightNode is well-tested

Screen Shot 2022-08-03 at 8 58 58 AM

Merge request reports

Loading