-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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: feature request directly go to item on exact match #84214
Comments
Rather than adding a new option, I would change the existing option to take you to the page if there's only one match or there's an exact match. |
If I'm reading this correctly, redirecting on an exact match when there's more than one result could be problematic if one type's name is the prefix of another (ex. searching for |
I don't see why that's true? OsString is not an exact match for OsStr. |
@rustbot claim |
I would like to try it. |
This could be problematic for slow typers due to Rustdoc's incremental search feature. I may be misunderstanding how this feature will work, but if I'm not, then the problem is as follows: the user may type out |
Oh I see - we could increase the delay for sending you to an exact match to something like a couple seconds. |
How about going to the first result when hitting the return key? |
Sure, that also seems useful, right now enter does nothing immediately after a search. I think we can do both :) |
I did not think about that issue but what @the8472 proposed sounds good to me. |
I will add these two features. |
@TrAyZeN Can you tell us more about the workflow you are using? Are you copy-pasting the fully-qualified path ( I agree with @jyn514 that we shouldn't have separate options for "directly go to single result" and "directly go to exact match." The former is already a niche feature, and off-by-default. We should update the existing feature to be something like "directly go to strong match," where a strong match is:
By the way, the current behavior, when you enable "directly go to single result", is that the navigation can be triggered if you pause for 500ms while typing. That's pretty surprising - and very unusual among search interfaces, as far as I know. I think as long as we're refining this functionality we should make navigation happen only if you hit enter. |
My workflow may not be optimal but I am using rustdoc search engine in my browser. I expected when typing |
Ah, that makes sense! I also have a search engine in my browser to search the rust docs (I use the prefix For this use case, we know when we're typing the search that we're going to want the "go to first result" behavior, regardless of whether it's an exact match, or a unique match. So we could follow the example of Google's "I'm feeling lucky" searches: we could have a query parameter that indicates "go to first result," and people could put that in their browser searches. For instance, it might look like Another model we could borrow from is macOS Spotlight / Windows Start Menu. In those systems, as you type, the "best match" is highlighted. If you hit enter at any time, that best match will be executed. If we adopted this style in rustdoc, it wouldn't solve the browser toolbar search, but it might make a good replacement for the current "go directly on exact match" setting, because it could be enabled by default. The downside is that this model relies on very fast updates as you type each character. Our current search doesn't have that - it doesn't search until you've paused typing for 500ms. Also it would be cool to try out OpenSearch to enable browser autodiscovery of the search functionality: https://martin-thoma.com/search-engine-autodiscovery/ |
Strongly agree with this; in general we should probably be probing how users use the tool more and make design decisions based on that kind of thing. I like the |
I also think the design is unusual, and if I were to expand on this feature I think it could lead to a bad experience, because maybe someone just wants to see similar results, but then they'll be forced to jump. |
I think this is a good solution. |
I found some more authoritative information on how Chrome discovers search engines automatically. OpenSearch is part of the story, but not all: http://code.google.com/p/chromium/issues/detail?id=2573
Unfortunately, Rust's documentation on doc.rust-lang.org misses out on all of these. There's no search functionality on the homepage; users don't usually type out the full hostname because it's long; and searching doesn't generate a GET, because it's all done in JavaScript (and because we do search-as-you-type, so there's no moment at which the user has to actually "submit" the form). The heuristics above actually do pick up on docs.rs' search functionality quite quickly, if you do a search from the homepage. |
The basic way to implement this would be to check for the rust/src/librustdoc/html/static/search.js Lines 1256 to 1291 in 9964284
|
@rustbot claim |
Add `go_to_first` query param to jump to first result Fixes rust-lang#84214 Note that while the issue initially wanted to navigate to an entry on exact match, the discussion settled on using a query parameter (`&go_to_first=true`) instead, regardless of exact or partial match. Demonstration is attached https://user-images.githubusercontent.com/4934853/120258768-7ff28980-c247-11eb-8c8f-1a2ceb242788.mp4
Problem
Hello, we already have an option Directly go to item in search if there is only one result which can be enabled in the settings
However, when typing an item path we have a lot of results that shows up and so we can rarely get redirected with the previous option.
Solution
I think that it could be useful to have a feature Directly go to item on exact match.
For instance, on the previous screenshot when typing
std::vec::Vec
it would redirect to the item page.The text was updated successfully, but these errors were encountered: