Skip to content

Commit c911eb0

Browse files
committed
Score based on user, repo
1 parent 25eab22 commit c911eb0

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/results.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ async def repo_results(repos: AsyncGenerator[Repo, None], limit: Optional[int] =
3030

3131
async def scored_repo_results(query: str, repos: AsyncGenerator[Repo, None]) -> AsyncGenerator[Result, None]:
3232
async for result in repo_results(repos):
33-
match = string_matcher(query, result.Title)
34-
if match:
35-
result.Score = match.score
33+
if query == "":
3634
yield result
35+
else:
36+
user, repo = result.Title.split("/")
37+
match_user, match_repo = string_matcher(query, user), string_matcher(query, repo)
38+
if match_user.matched or match_repo.matched:
39+
result.Score = max(match_user.score, match_repo.score)
40+
yield result
3741

3842

3943
def context_menu_results(full_name: str, html_url: str):

0 commit comments

Comments
 (0)