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

keep queries when doing lucky, :: or crate-name searches #1830

Merged
merged 4 commits into from
Sep 24, 2022

Conversation

Emilgardis
Copy link
Contributor

@Emilgardis Emilgardis commented Sep 12, 2022

enables https://docs.rs/releases/search?query=tokio::spawn&i-am-feeling-lucky=1&go_to_first=true

to go to first result after redirect

useful for %s keyword search

@github-actions github-actions bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Sep 12, 2022
@Nemo157
Copy link
Member

Nemo157 commented Sep 12, 2022

I would really like something like go_to_exact in rustdoc that we could add for the :: redirects. I don't think we can just add go_to_first always because e.g. https://docs.rs/tokio?search=tokio::span&go_to_first=true goes to the tokio::spawn docs.

In the meantime I think merging the queries like this is good, we could also support it on the crate-name handler so that https://docs.rs/tokio::spawn?go_to_first=true works; but that's unlikely to be something you want to write yourself so having this only for people wrapping the search handler seems fine.

@Emilgardis
Copy link
Contributor Author

Implemented the proposed functionality!

@Emilgardis
Copy link
Contributor Author

Emilgardis commented Sep 12, 2022

Hmm, I managed to get the web-server spinning now (on a mac :3) and I'm not sure this is working as intended.

nevermind, it works, not sure what I did wrong

@Emilgardis Emilgardis changed the title keep queries when doing lucky or :: searches keep queries when doing lucky, :: or crate-name searches Sep 12, 2022
@Emilgardis Emilgardis changed the title keep queries when doing lucky, :: or crate-name searches keep queries when doing lucky, :: or crate-name searches Sep 12, 2022
enables

`docs.rs/releases/search?query=tokio::spawn&i-am-feeling-lucky=1&go_to_first=true`

and

`docs.rs/tokio::spawn?go_to_first=true`

to go to first result after redirect
src/web/releases.rs Outdated Show resolved Hide resolved
src/web/rustdoc.rs Outdated Show resolved Hide resolved
@syphar syphar added S-waiting-on-author Status: This PR is incomplete or needs to address review comments and removed S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Sep 17, 2022
@syphar
Copy link
Member

syphar commented Sep 17, 2022

In general a deeper integration with rustdoc specifics feels good to me.

( though rust-analyzers experimental/externalDocs could solve this issue already in a more correct way)

@Emilgardis
Copy link
Contributor Author

Emilgardis commented Sep 17, 2022

I just realized I did this on my master branch, so a squash + force push will probably have github close this issue :) ...

I think I've fixed this by changing the default branch on my fork

@Emilgardis
Copy link
Contributor Author

@rustbot modify labels: +T-waiting-on-review, -T-waiting-on-author

@rustbot
Copy link
Collaborator

rustbot commented Sep 21, 2022

Error: Label T-waiting-on-review can only be set by Rust team members

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip.

@Emilgardis
Copy link
Contributor Author

it's S...

@rustbot modify labels: +S-waiting-on-review, -S-waiting-on-author

@syphar syphar added S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed and removed S-waiting-on-author Status: This PR is incomplete or needs to address review comments labels Sep 21, 2022
Copy link
Member

@syphar syphar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pushing this improvement forward!

I had ideas around some improvements, let me know what you think!

src/web/releases.rs Outdated Show resolved Hide resolved
src/web/rustdoc.rs Show resolved Hide resolved
src/web/rustdoc.rs Outdated Show resolved Hide resolved
src/web/releases.rs Outdated Show resolved Hide resolved
@syphar syphar added S-waiting-on-author Status: This PR is incomplete or needs to address review comments and removed S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Sep 23, 2022
@Emilgardis
Copy link
Contributor Author

I've applied the suggestions

@Emilgardis
Copy link
Contributor Author

Emilgardis commented Sep 24, 2022

@rustbot modify labels: +S-waiting-on-review, -S-waiting-on-author

edit: it really doesn't let me, the config file suggests I should be able to

@syphar
Copy link
Member

syphar commented Sep 24, 2022

@Emilgardis I'm on my phone so I don't see details
Could you check the failing tests?

@Emilgardis
Copy link
Contributor Author

Emilgardis commented Sep 24, 2022

ah great, I only tested locally with cargo test -- web::r as I assumed that would be the only place that this would take effect. Should be fixed now

Copy link
Member

@syphar syphar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry about the back & forth, I'll approve & merge.

Manual test is fine, removing the empty ? at the end I'll leave to myself later :)

@syphar syphar merged commit 111865a into rust-lang:master Sep 24, 2022
@github-actions github-actions bot added S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it and removed S-waiting-on-author Status: This PR is incomplete or needs to address review comments labels Sep 24, 2022
@GuillaumeGomez
Copy link
Member

About testing, it could also be added into #1698.

@syphar syphar removed the S-waiting-on-deploy This PR is ready to be merged, but is waiting for an admin to have time to deploy it label Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants