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: restructure type search engine to pick-and-use IDs #110371

Merged
merged 6 commits into from
May 4, 2023

Conversation

notriddle
Copy link
Contributor

@notriddle notriddle commented Apr 15, 2023

Fixes #110029

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

image

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.

@rustbot
Copy link
Collaborator

rustbot commented Apr 15, 2023

r? @GuillaumeGomez

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 15, 2023
@rustbot
Copy link
Collaborator

rustbot commented Apr 15, 2023

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @Folyd, @jsha

@GuillaumeGomez
Copy link
Member

Instead of just writing Showing result for "x", I think it'd be a good idea to add context, like No function with arguments "String", showing results for the closest instead: "x" (or something along the line).

Also, when are making this correction? In case no item is named streaming or in case there is no streaming item in any function arguments?

@notriddle
Copy link
Contributor Author

notriddle commented Apr 16, 2023

Also, when are making this correction? In case no item is named streaming or in case there is no streaming item in any function arguments?

No streaming item in any function arguments or returns. The index is built up by iterating function definitions, so everything in there appears in at least one function.

@notriddle notriddle force-pushed the notriddle/search-corrections branch from 555477b to 98e2b98 Compare April 17, 2023 18:58
@rust-log-analyzer

This comment has been minimized.

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.
@notriddle notriddle force-pushed the notriddle/search-corrections branch from 98e2b98 to 4c11822 Compare April 17, 2023 19:16
@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/search-corrections branch from f22821a to ec0bb1c Compare April 19, 2023 18:04
@notriddle
Copy link
Contributor Author

@GuillaumeGomez Updated screenshot and PR with new message.

@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/search-corrections branch from ec0bb1c to b6f81e0 Compare April 19, 2023 19:56
@GuillaumeGomez

This comment was marked as resolved.

}
}

for (const elem of parsedQuery.elems) {
Copy link
Member

Choose a reason for hiding this comment

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

I thought we only ran this in case there is one element? That seems a bit weird to apply this on multiple elements no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the name-to-id conversion process runs for any number of elements. The only part that's conditional on there being a single element is the if (!parsedQuery.literalSearch) part, since multi-element queries are always literal.

@notriddle
Copy link
Contributor Author

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Apr 20, 2023

Team member @notriddle has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Apr 20, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 pull request 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 added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2023
…earth

Rollup of 10 pull requests

Successful merges:

 - rust-lang#97594 (Implement tuple<->array convertions via `From`)
 - rust-lang#105452 (Add cross-language LLVM CFI support to the Rust compiler)
 - rust-lang#105695 (Replace generic thread parker with explicit no-op parker)
 - rust-lang#110371 (rustdoc: restructure type search engine to pick-and-use IDs)
 - rust-lang#110928 (tests: Add tests for LoongArch64)
 - rust-lang#110970 (tidy: remove ENTRY_LIMIT maximum checking and set it to 900)
 - rust-lang#111104 (Update ICU4X to 1.2)
 - rust-lang#111127 (Constify slice flatten method)
 - rust-lang#111146 (rustc_middle: Fix `opt_item_ident` for non-local def ids)
 - rust-lang#111154 (Use builtin FFX isolation for Fuchsia test runner)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ceef7e5 into rust-lang:master May 4, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 4, 2023
@notriddle notriddle deleted the notriddle/search-corrections branch May 4, 2023 14:29
@apiraino apiraino removed the to-announce Announce this issue on triage meeting label May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustdoc search: invalid "in parameters" results for "streaming"
8 participants