Uh oh!
There was an error while loading. Please reload this page.
Improve searching in rustdoc and add tests - #64094
Conversation
jonas-schievink
commented
Sep 2, 2019
| const EXPECTED = { | ||
| 'others': [ | ||
| { 'path': 'std::vec::Vec', 'name': 'new' }, | ||
| { 'path': 'std::rc::Rc', 'name': 'new' }, |
There was a problem hiding this comment.
This is less good result. We specified Vec explicitly in here after all.
| @@ -0,0 +1,19 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
I don't really understand the point of this little script (even with your explanations). You can already do it using the x.py script (which could be better documented I guess).
GuillaumeGomez
commented
Sep 2, 2019
Thanks for the PR! Could you describe a bit more what you're trying to achieve in here? A test seemed like having less good results so I just want to be sure to fully understand what you have in mind with this PR. |
ayuusweetfish
commented
Sep 2, 2019
Ah sure. I intended to prioritize methods with the same name (final word). This could be helpful in that it would be possible get accurate results even if we only remember the last word (#59287 shows such a use case). If we want to know about methods in a particular type or module, we can always go to its own page instead. It was my carelessness to have missed the |
GuillaumeGomez
commented
Sep 2, 2019
I don't really agree with this: if you specified the parent item (so On another case, if you're looking for a type and you make a typo, you want both the type and the method to be somewhat at the same level, not all methods then the type (based on the fact that they have the same levenhstein level result).
No worries, |
ayuusweetfish
commented
Sep 3, 2019
Previously As for results ordering, we can keep only the most intuitive requirements in tests and get rid of others, but I'd like to insist on this implementation. (tl;dr ends here 😝)
I think it's usually easy for the user to fix the typo themself, and it should be fine as long as we are returning meaningful results. When we type Many other documentation sites are doing it this way as well: Hoogle (List.init), cppreference.com (vector::size). |
GuillaumeGomez
commented
Sep 4, 2019
You should send a new PR for the Otherwise, I still have issues to see how these changes improve the search... Normally, exact matches are put up by adding a small advantage. Or did I miss something? |
Okay, I shall separate the This mainly aims at two use cases that current nightly does not handle well:
Edit: relevant logic ↓ rust/src/librustdoc/html/static/main.js Lines 1102 to 1106 in b9de4ef This advantage is by no means small, and overwrites the Levenshtein biases completely. rust/src/librustdoc/html/static/main.js Lines 561 to 564 in b9de4ef These have no effect in many cases, because I should have explained it earlier, sorry for the confusion ._. |
ayuusweetfish
commented
Sep 4, 2019
Is it better now? |
GuillaumeGomez
commented
Sep 4, 2019
Yes, I prefer the current result. Can you squash your commits please? Once done, I'll approve the PR. |
dd2de55 to
285650aCompareayuusweetfish
commented
Sep 4, 2019
Accidentally messed up, fixing 😓 |
285650a to
3f37938Compare3f37938 to
cb84aa4Compareayuusweetfish
commented
Sep 4, 2019
I think it's ready now! |
GuillaumeGomez
commented
Sep 4, 2019
Thanks! @bors: r+ rollup |
bors
commented
Sep 4, 2019
📌 Commit cb84aa4 has been approved by |
…umeGomez Improve searching in rustdoc and add tests 👋 I have made searching in rustdoc more intuitive, added a couple more tests and made a little shell script to aid testing. Closesrust-lang#63005. It took me quite a while to figure out how to run the tests for rustdoc (instead of running tests for other crates with rustdoc); the only pointer I found was [hidden in the rustc book](https://rust-lang.github.io/rustc-guide/rustdoc.html#cheat-sheet). Maybe this could be better documented? I shall be delighted to help if it is desirable.
…umeGomez Improve searching in rustdoc and add tests 👋 I have made searching in rustdoc more intuitive, added a couple more tests and made a little shell script to aid testing. Closesrust-lang#63005. It took me quite a while to figure out how to run the tests for rustdoc (instead of running tests for other crates with rustdoc); the only pointer I found was [hidden in the rustc book](https://rust-lang.github.io/rustc-guide/rustdoc.html#cheat-sheet). Maybe this could be better documented? I shall be delighted to help if it is desirable.
Rollup of 5 pull requests Successful merges: - #63676 (Use wasi crate for Core API) - #64094 (Improve searching in rustdoc and add tests) - #64111 (or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve) - #64156 (Assume non-git LLVM is fresh if the stamp file exists) - #64175 (Fix invalid span generation when it should be div) Failed merges: - #63806 (Upgrade rand to 0.7) r? @ghost
…umeGomez Improve searching in rustdoc and add tests 👋 I have made searching in rustdoc more intuitive, added a couple more tests and made a little shell script to aid testing. Closesrust-lang#63005. It took me quite a while to figure out how to run the tests for rustdoc (instead of running tests for other crates with rustdoc); the only pointer I found was [hidden in the rustc book](https://rust-lang.github.io/rustc-guide/rustdoc.html#cheat-sheet). Maybe this could be better documented? I shall be delighted to help if it is desirable.
…umeGomez Improve searching in rustdoc and add tests 👋 I have made searching in rustdoc more intuitive, added a couple more tests and made a little shell script to aid testing. Closesrust-lang#63005. It took me quite a while to figure out how to run the tests for rustdoc (instead of running tests for other crates with rustdoc); the only pointer I found was [hidden in the rustc book](https://rust-lang.github.io/rustc-guide/rustdoc.html#cheat-sheet). Maybe this could be better documented? I shall be delighted to help if it is desirable.
Rollup of 10 pull requests Successful merges: - #63676 (Use wasi crate for Core API) - #64094 (Improve searching in rustdoc and add tests) - #64111 (or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve) - #64156 (Assume non-git LLVM is fresh if the stamp file exists) - #64161 (Point at variant on pattern field count mismatch) - #64174 (Add missing code examples on Iterator trait) - #64175 (Fix invalid span generation when it should be div) - #64186 (std: Improve downstream codegen in `Command::env`) - #64190 (fill metadata in rustc_lexer's Cargo.toml) - #64198 (Add Fuchsia to actually_monotonic) Failed merges: r? @ghost
👋 I have made searching in rustdoc more intuitive, added a couple more tests and made a little shell script to aid testing. Closes#63005.
It took me quite a while to figure out how to run the tests for rustdoc (instead of running tests for other crates with rustdoc); the only pointer I found was hidden in the rustc book. Maybe this could be better documented? I shall be delighted to help if it is desirable.