Skip to content

Sort the code search result by relevance #32129

Closed
@bsofiato

Description

@bsofiato

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions