Skip to content

rustdoc search: rank identity functions lower unless requested #132285

Closed as duplicate of#134935
@lolbinarycat

Description

@lolbinarycat

whenever you perform a -> SomeType query, two results almost always show up in the top 5 results: SomeType::clone, and the reflexive SomeType::from.

when people perform this type of search, they are almost always doing it because they need a value of that type, and don't already have one.

I think that when there are no input arguments in a type-based search, we should rank items that take their return type as an argument below those that don't. if repeatedly checking the arguments of functions during sort has significant performance impact, we can amortize it by caching this property in the search index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-searchArea: Rustdoc's search featureA-type-based-searchArea: Searching rustdoc pages using type signaturesC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions