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: invalid "in parameters" results for "streaming" #110029

Closed
jsha opened this issue Apr 6, 2023 · 2 comments · Fixed by #110371
Closed

rustdoc search: invalid "in parameters" results for "streaming" #110029

jsha opened this issue Apr 6, 2023 · 2 comments · Fixed by #110371
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jsha
Copy link
Contributor

jsha commented Apr 6, 2023

Steps to reproduce:

  1. Search for "streaming" in the hyper docs: https://docs.rs/hyper/0.14.25/hyper/index.html?search=streaming (built with 2023-03-09 nightly rustdoc).

Expected results:

Either a struct with Streaming in the name appears, or no results.

Actual results:

Search page automatically shows the "In parameters" tab, and it contains results for several functions that don't mention "streaming" in their parameters.

image

@jsha jsha added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Apr 6, 2023
@notriddle
Copy link
Contributor

notriddle commented Apr 9, 2023

It looks like these are "legit" matches, according to the edit distance function, for the word "string", which appears in all of the returned matches, because it has an edit distance of 3 (streaming).

Do you think it would be better to make "In parameters" and "in return types" not do fuzzy name matching, regardless of the complexity of the query? It would certainly make the search code simpler!

Note: while some of those links seem to point at functions with no "string" in their type signatures, that's just #109422 showing up, and there are functions with the same name on that page that have "string" in their type signatures.

Corrected links to all the functions

The exception is this one, with "stream" (which obviously is a good match for "streaming"):

@jsha
Copy link
Contributor Author

jsha commented Apr 14, 2023

Probably the biggest problem here is that "In parameters" and "In return types" don't show the function signatures that are being matched against, so it's hard to understand why a given function might match. I think it would be good to show those function signatures. That does imply longer, multiline search results for those two tabs, so they'd have a significantly different UI than the default tab. But I think that's okay.

I also think it's counterintuitive that we automatically jump to "In parameters" and "In return types" when there are no results for the default tab. I think we should only switch to those tabs on explicit user request.

The other thing is that streaming feels like a bad match for string. Perhaps it's because all of the "edits" are in a row, or perhaps it's because they are all insertions. It would be very unusual for someone to typo adding three letters in sequence (and expect it to still match).

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue May 1, 2023
…ions, r=GuillaumeGomez

rustdoc: restructure type search engine to pick-and-use IDs

Fixes rust-lang#110029

Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming

![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png)

This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items.

This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue May 2, 2023
…ions, r=GuillaumeGomez

rustdoc: restructure type search engine to pick-and-use IDs

Fixes rust-lang#110029

Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming

![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png)

This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items.

This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue May 3, 2023
…ions, r=GuillaumeGomez

rustdoc: restructure type search engine to pick-and-use IDs

Fixes rust-lang#110029

Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming

![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png)

This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items.

This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue May 3, 2023
…ions, r=GuillaumeGomez

rustdoc: restructure type search engine to pick-and-use IDs

Fixes rust-lang#110029

Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming

![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png)

This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items.

This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue May 3, 2023
…ions, r=GuillaumeGomez

rustdoc: restructure type search engine to pick-and-use IDs

Fixes rust-lang#110029

Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming

![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png)

This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items.

This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
Manishearth added a commit to Manishearth/rust that referenced this issue May 3, 2023
…ions, r=GuillaumeGomez

rustdoc: restructure type search engine to pick-and-use IDs

Fixes rust-lang#110029

Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming

![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png)

This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items.

This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
Manishearth added a commit to Manishearth/rust that referenced this issue May 3, 2023
…ions, r=GuillaumeGomez

rustdoc: restructure type search engine to pick-and-use IDs

Fixes rust-lang#110029

Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming

![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png)

This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items.

This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
Manishearth added a commit to Manishearth/rust that referenced this issue May 3, 2023
…ions, r=GuillaumeGomez

rustdoc: restructure type search engine to pick-and-use IDs

Fixes rust-lang#110029

Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming

![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png)

This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items.

This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
@bors bors closed this as completed in ceef7e5 May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants