Skip to content

rustdoc book: document sorting of search results #135447

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

Open
lolbinarycat opened this issue Jan 13, 2025 · 9 comments
Open

rustdoc book: document sorting of search results #135447

lolbinarycat opened this issue Jan 13, 2025 · 9 comments
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-rustdoc-search Area: Rustdoc's search feature T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. 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

currently, the sorting of search results is a bit of a black box. we should add a subsection in the rustdoc book about how the sorting works.

based on this comment.

@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 Jan 13, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 13, 2025
@jieyouxu jieyouxu added A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 13, 2025
@notriddle
Copy link
Contributor

There are three reasons why I hesitate to do this.

  1. The more docs we write, the more we have to keep up-to-date. Incorrect docs are worse than incomplete docs.

  2. Ranking is essentially guesswork. Other than the commonsense1 rule that exact matches should appear first, we have to assume that the user knows roughly, but not exactly, what they're looking for.

  3. Ranking is zero-sum. We can't make it easier to find anything without, by definition, making it harder to find something else.

Footnotes

  1. this is not true if you're trying to filter out spam, but rustdoc doesn't have to deal with that

@lolbinarycat
Copy link
Contributor Author

hmm... all of these are valid points.

@hkBst
Copy link
Member

hkBst commented Jan 19, 2025

Maybe document that? Exact results first, other results based on some scoring system (I am guessing) which is subject to change.

Though I can't help but think about evaluating the scoring system, that is, what makes it good/acceptable/workable.

@xizheyin
Copy link
Contributor

Some structures have very many and complex methods, such as this, is it possible to search by description?

@hkBst
Copy link
Member

hkBst commented Feb 25, 2025

@xizheyin if you're on the page you can use your browser's in-page search, but I'm sure that's not what you mean. Can you explain a little more what you do mean?

@lolbinarycat
Copy link
Contributor Author

@xizheyin full text search is not supported, no.

you can however, use a regular search engine with a site: filter.

you may also be interested in type-based search, which is helpful for seeing how various types are constructed and retrieved.

@xizheyin
Copy link
Contributor

xizheyin commented Feb 26, 2025

@hkBst I meant pretty much what @lolbinarycat said, which probably means searching for features as described in the API. Searching by using a regular search engine is a good idea!

By the way,
I have another question. Is it possible to allow users/developers to contribute use cases or explanations to the documentation on the documentation's website (with the developer reviewing and presenting them), which would be easier than writing the documentation in code and submitting PR. Especially for heavily used libraries, the base of users is much larger than the developers.

I can start a separate issue if that makes sense.

@notriddle
Copy link
Contributor

Rustdoc is a static site generator. User-contributed notes like php.net can't be done with this architecture.

Theoretically, docs.rs could do it, but they do not have the bandwidth to protect a public platform from spam.

Having the crate author review user-contributed notes helps with bad suggestions posted by humans, but bot spam can only be dealt with automatically, and only the platform owner can do that. Only the platform owner can see your IP address, force you to solve a CAPTCHA, or fingerprint your browser / interaction timing. Without any of this stuff, the poor volunteer crate author is outnumbered.

Platforms like Reddit and GitHub have volunteer mods as a complement to automated bot blocking, not an alternative.

@xizheyin
Copy link
Contributor

I get it, thanks for the explanation!

@fmease fmease added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools A-rustdoc-search Area: Rustdoc's search feature T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. 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

7 participants