Skip to content
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

[rustdoc search] sort stable items above unstable ones #138067

Open
lolbinarycat opened this issue Mar 5, 2025 · 4 comments
Open

[rustdoc search] sort stable items above unstable ones #138067

lolbinarycat opened this issue Mar 5, 2025 · 4 comments
Assignees
Labels
A-rustdoc-search Area: Rustdoc's search feature needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Comments

@lolbinarycat
Copy link
Contributor

I looked up "channel", clicked on the first result, copied that path to my code...

and was very surprised when i was actually using the unstable mpmc one instead of the stable mpsc channel.

I think name/path matching should generally take priority (otherwise people who are actually looking for unstable items would be massively inconvenienced), but when two items have the same distance, we should prioritize the one that is stable.

@lolbinarycat lolbinarycat added A-rustdoc-search Area: Rustdoc's search feature T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Mar 5, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 5, 2025
@lolbinarycat
Copy link
Contributor Author

if this isn't already possible with the data in the search index, i believe the final tiebreak is the order in which things appear in the search index, so perhaps we could pre-sort that so all the stable options appear first?

@xizheyin
Copy link
Contributor

xizheyin commented Mar 6, 2025

I think this should allow the developer to make a choice. Maybe they can set different priorities for the pass attributes of these items.

@lolbinarycat
Copy link
Contributor Author

@xizheyin this is a very niche situation, it requires two items that have the same name (or at least the same length of name and a common substring), it requires exactly one of them to be unstable (and thus it can only happen for stdlib types), and it requires a developer to search for that function, and only then will it result in a very small difference in sorting. adding an option here would be highly excessive.

@xizheyin
Copy link
Contributor

xizheyin commented Mar 7, 2025

Makes sense. I think we can indeed rank STABLE first

@lolbinarycat lolbinarycat self-assigned this Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-search Area: Rustdoc's search feature needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

No branches or pull requests

3 participants