Skip to content

Sort the code search result by relevance #32129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bsofiato opened this issue Sep 25, 2024 · 0 comments · Fixed by #32134
Closed

Sort the code search result by relevance #32129

bsofiato opened this issue Sep 25, 2024 · 0 comments · Fixed by #32134
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Milestone

Comments

@bsofiato
Copy link
Contributor

Feature Description

I noticed that the code search uses the repo_id to sort the results. I propose we start sorting by relevance (i.e., by _score).

This will be needed by #32096 (I've noticed this while coding it), as GitHub's search considers matches in filenames more relevant than those in content. Moreover, Sorting by relevance seems more sensible than sorting by the repo_id.

If you guys are ok with it, I'll open a PR.

P.S. It was hard to decide if this was a bug or a feature. In the end, I went with the latter since the code search does work.

P.S. Both ElasticSearch and Bleve allow sorting by relevance.

Screenshots

No response

@bsofiato bsofiato added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Sep 25, 2024
@lunny lunny added this to the 1.23.0 milestone Sep 28, 2024
lunny pushed a commit that referenced this issue Sep 28, 2024
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Dec 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants