Skip to content

Commit

Permalink
[FEATURE] - Using Repository Name in Search (#287)
Browse files Browse the repository at this point in the history
[CLI] - Using Repository Name in Search

At present we only take into account the description and the topics when searching for terms. With this PR we also using the name of the repository as well
  • Loading branch information
gambol99 authored Aug 1, 2022
1 parent 993c466 commit 99d9614
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/cmd/search/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ func (r *ghClient) searchByOrganization(ctx context.Context, _ search.Query) ([]
func containsTerms(query string, repostory *githubcc.Repository) bool {
terms := strings.ToLower(strings.ReplaceAll(repostory.GetDescription(), ",", " "))
terms = terms + " " + strings.ToLower(strings.Join(repostory.Topics, " "))
terms = terms + " " + strings.ToLower(strings.ReplaceAll(repostory.GetName(), "-", " "))

lower := strings.ToLower(query)

return utils.ContainsList(strings.Split(lower, " "), strings.Split(terms, " "))
Expand Down

0 comments on commit 99d9614

Please sign in to comment.