-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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: sort deprecated items lower in search #107629
Conversation
r? @jsha (rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @Folyd, @jsha |
Thanks for the PR but no decision was reached on the issue so it might be a bit too early. Don't hesitate to bring it up on the #t-rustdoc channel on our zulip instance. |
Fwiw, I think this would still be nice outside of #107587. Probably moreso in crates, which tend to have a lot more deprecations than std, but there are still a few cases floating around there as well. A |
This comment was marked as outdated.
This comment was marked as outdated.
Okay it seems like this isn't blocked on anything. Should be able to move forward with an FCP here once the review is complete. Zulip discussion for reference @jsha mind taking a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! Sorting the deprecated items lower is good; I think we should not add the "Deprecation planned" / "Deprecated" right there in the search results, because it actually draws more attention to the less important items, and because it uses up valuable space.
Implementation-wise, I think the priority where you've placed the sorting-level tweak for deprecation is good. Better string matches should take priority over the deprecation bump. 👍🏻 One thing I notice, looking at these, is that there's a bump for "shorter item name." In theory that should make char::is_ascii
rank above std::ascii::AsciiExt::is_ascii
even without this PR. But that's not the case. I think there's a separate issue - the "same crate" bump is giving std::ascii::AsciiExt::is_ascii
priority when searching in std
. We should fix that separately - for instance, by treating all primitives as "same crate" relative to std, core, and alloc.
For storage in the JSON search index, this PR includes a 0
for all non-deprecated items. That's not very efficient for the typical case where most items are non-deprecated. How about instead storing a list of item indexes that are deprecated? And could you include a before/after size of the search index for the std/core/alloc docs (i.e. the output from ./x.py doc
)?
Hmm. I think having that information in the search results is quite useful and would save people time. What about using a text effect such as strikethrough, color, or opacity? |
@jsha okay I've remove the deprecation message from the search results. I've also switched the deprecated and "full path" columns to a sparse style, reducing the search index size by 4%
|
I also looked into this a little. It's not that the primitives don't count as being in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just one comment fix and we're ready to go.
reducing the search index size by 4%
oh, very nice!
And thanks for the research on why the "shorter name" match wasn't sufficient to rank the primitive associated items higher. That's good to know.
Looks great! Thanks. Want to squash the commits? r=me with that done. |
serialize `q` (`itemPaths`) sparsely overall 4% reduction in search index size
Squash complete r? @jsha |
Could not assign reviewer from: |
@bors r=jsha rollup |
…=jsha rustdoc: sort deprecated items lower in search closes rust-lang#98759 ### Screenshots `i32::MAX` show sup above `std::i32::MAX` and `core::i32::MAX` ![image](https://user-images.githubusercontent.com/803701/216725619-40afb7b0-e984-4a2e-ab5b-a95b24736b0e.png) If just searching for `min`, the deprecated results show up far below other things: ![image](https://user-images.githubusercontent.com/803701/216725672-e4325d37-9bfe-47eb-a1fe-0e57092aa811.png) one page later ![image](https://user-images.githubusercontent.com/803701/216725932-cd1c4a42-d527-44fb-a4ab-5a6d243659cc.png) ~~And, as you can see, the "Deprecation planned" message shows up in the search results. The same is true for fully-deprecated items like `mem::uninitialized`: ![image](https://user-images.githubusercontent.com/803701/216726268-1657e77a-563f-45a0-85a7-3a0cf4d66d6f.png)~~ Edit: the deprecation message change was removed from this PR. Only the sorting is changed.
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#106276 (Fix `vec_deque::Drain` FIXME) - rust-lang#107629 (rustdoc: sort deprecated items lower in search) - rust-lang#108711 (Add note when matching token with nonterminal) - rust-lang#108757 (rustdoc: Migrate `document_item_info` to Askama) - rust-lang#108784 (rustdoc: Migrate sidebar rendering to Askama) - rust-lang#108927 (Move __thread_local_inner to sys) - rust-lang#108949 (Honor current target when checking conditional compilation values) - rust-lang#108950 (Directly construct Inherited in typeck.) - rust-lang#108988 (rustdoc: Don't crash on `crate` references in blocks) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
A friend recently pointed out that since this PR, the comment in search.js (which they found very helpful) has gone stale: rust/src/librustdoc/html/static/js/search.js Lines 2488 to 2525 in 738df13
@pitaj would you be willing to send another PR fixing the comment to reflect the updated format? |
…GuillaumeGomez rustdoc: update comment in search.js for rust-lang#107629 Addressing rust-lang#107629 (comment) r? `@jsha`
…llaumeGomez Rollup of 3 pull requests Successful merges: - rust-lang#115478 (Emit unused doc comment warnings for pat and expr fields) - rust-lang#115490 (rustdoc: update comment in search.js for rust-lang#107629) - rust-lang#115503 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
closes #98759
Screenshots
i32::MAX
show sup abovestd::i32::MAX
andcore::i32::MAX
If just searching for
min
, the deprecated results show up far below other things:one page later
And, as you can see, the "Deprecation planned" message shows up in the search results. The same is true for fully-deprecated items like
mem::uninitialized
:Edit: the deprecation message change was removed from this PR. Only the sorting is changed.