search: expose GitHub/GitLab topics in UI#58927
Conversation
This PR adds a resolver for topics and exposes them in the UI. Currently, we sync topics from GitHub and GitLab and it is possible to filter repositoroes by their topicss with the `repo:has.topic` filter. However, the synced topics are not visible in the UI, neither in the search results nor on the repo tree page.
d39f3b4 to
7f01950
Compare
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff bc35ae5...f9fdc6a.
|
| metadata, ok, err := unmarshalMetadata(s.logger, typ, metadataBytes) | ||
| if err != nil { | ||
| return err | ||
| } else if ok { | ||
| r.Topics = GetTopics(metadata) | ||
| } |
There was a problem hiding this comment.
There is a virtual column on the repo table called topics that you can just query for this info. We should use that.
There was a problem hiding this comment.
Oops. I didn't see that. That makes things a bit tidier.
camdencheek
left a comment
There was a problem hiding this comment.
This looks great, thank you!
| const showRepoMetadata = enableRepositoryMetadata && !!metadata | ||
| const showExtraInfo = result.archived || result.fork || result.private | ||
|
|
||
| const metadataTags = !metadata |
There was a problem hiding this comment.
I don't think we want to assert with ! here since we're doing a type-safe check with ... ? ... : ..., right? Same with topics below?
| <ExtraInfoSectionItemHeader title="Description" tooltip="Synchronized from the code host" /> | ||
| {repo.description && <Text>{repo.description}</Text>} | ||
| </ExtraInfoSectionItem> | ||
| <ExtraInfoSectionItem> |
There was a problem hiding this comment.
Should this section only be rendered if the repo has topics? In particular, it seems odd to show a section for this, say, on Bitbucket.
There was a problem hiding this comment.
Should this section only be rendered if the repo has topics?
Done
Currently, we sync topics from GitHub and GitLab and it is possible to filter repositories by their topics with the `repo:has.topic` filter. However, unlike user-added metadata, the synced topics are not visible in the UI, neither for repo matches nor on the repo tree page. This means it is impossible for users to figure out which topics they can filter by. With this PR we display topics, such as "language" or "golang", in addition to user-added metadata for repo matches and on the repo tree page. ## Test plan Note: Our search language distinguishes between user provided metadata (has.meta) and automatically synced metadata (has.topic). - manual testing - I checked that clicking on a "topic" badge adds a "has.topic" filter, while clicking on a "metadata" badge add a "has.meta" filter - Adding and deleting metadata works like before - Topics and metadata are sorted alphabetically - Results without metadata or topics are displayed correctly - added new unit test (cherry picked from commit 7da4c4e)
Relates to #58927 test plan: just a doc change
Relates to #58927 test plan: just a doc change
Currently, we sync topics from GitHub and GitLab and it is possible to
filter repositories by their topics with the
repo:has.topicfilter.However, unlike user-added metadata, the synced topics are not visible in the UI,
neither for repo matches nor on the repo tree page. This means it is impossible
for users to figure out which topics they can filter by.
With this PR we display topics, such as "language" or "golang", in addition to
metadata (EG
fruit:banana) for repo matches and on the repo tree page (see screenshots).Search results

Repository tree page (right panel)

Test plan
Note: Our search language distinguishes between user provided metadata (has.meta) and automatically synced metadata (has.topic).