# Documentation search engine (Chrome quick search)

**URL:** <https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612>\
**Category:** documentation\
**Created:** [February 18, 2015, 1:18pm UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612 "2015-02-18T13:18:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![LukasKalbertodt](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/lukaskalbertodt/32/2883_2.png) [@LukasKalbertodt](https://internals.rust-lang.org/u/LukasKalbertodt)\
**Post date:** [February 18, 2015, 1:18pm UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612/1 "2015-02-18T13:18:27Z")

</div>

Hi,

my current method to search through the Rust documentation (in Chrome) is:

1. `Ctrl + T` (opening new tab)
2. Typing “do” -\> Chrome suggest “[doc.rust-lang.org/std/](http://doc.rust-lang.org/std/)” to me.

- Pressing Enter
- Waiting up to a second until JS is ready ☹
- Press S and finally search

You see… step 4 sucks. I would like to use the fancy “new” chrome search… where I type “yo” to get “[youtube.com](http://youtube.com)”, press `Tab` to switch to the youtube search and can immediately search.

Are there any plans to make it happen?

---

<div class="post-metadata">

**Author:** ![msiemens](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/msiemens/32/288_2.png) [@msiemens](https://internals.rust-lang.org/u/msiemens)\
**Post date:** [February 18, 2015, 1:38pm UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612/2 "2015-02-18T13:38:41Z")

</div>

Here’s a description of this behavior from the Chromium docs: [http://www.chromium.org/tab-to-search](http://www.chromium.org/tab-to-search)

---

<div class="post-metadata">

**Author:** ![msiemens](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/msiemens/32/288_2.png) [@msiemens](https://internals.rust-lang.org/u/msiemens)\
**Post date:** [February 18, 2015, 1:39pm UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612/3 "2015-02-18T13:39:47Z")

</div>

Implementing OpenSearch also would make it possible to add the docs as a search engine provider in Firefox.

---

<div class="post-metadata">

**Author:** ![LukasKalbertodt](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/lukaskalbertodt/32/2883_2.png) [@LukasKalbertodt](https://internals.rust-lang.org/u/LukasKalbertodt)\
**Post date:** [February 18, 2015, 1:54pm UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612/4 "2015-02-18T13:54:17Z")

</div>

> [@msiemens](#):
>
> Implementing OpenSearch

... doesn't sound to difficult, does it? I don't know who is responsible for the documentation site... I would really appreciate this feature.

---

<div class="post-metadata">

**Author:** ![Gankra](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/gankra/32/6002_2.png) [@Gankra](https://internals.rust-lang.org/u/Gankra)\
**Post date:** [February 18, 2015, 4:11pm UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612/5 "2015-02-18T16:11:55Z")

</div>

> [@LukasKalbertodt](#):
>
> ... doesn't sound to difficult, does it? I don't know who is responsible for the documentation site... I would really appreciate this feature.

PRs welcome 😉

[https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/static/main.js](https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/static/main.js)

> <https://github.com/rust-lang/rust/blob/master/src/librustdoc/html/layout.rs>

---

<div class="post-metadata">

**Author:** ![LukasKalbertodt](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/lukaskalbertodt/32/2883_2.png) [@LukasKalbertodt](https://internals.rust-lang.org/u/LukasKalbertodt)\
**Post date:** [February 18, 2015, 10:45pm UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612/6 "2015-02-18T22:45:16Z")

</div>

There are some problems here:

1. Chrome will just activate tab-to-search for sites visited without a path. So `doc.rust-lang.org/std` won’t work. And since every crate has it’s own search index, it doesn’t make sense to add the search to `doc.rust-lang.org` directly. Would it be possible to create a new sub domain like `std.rust-lang.org`? I guess that would be nice to have for some other reasons too.
2. The opensearch specification seems just to allow absolute URLs (including the server!). Rustdoc is just creates static html files… That would be a problem. Chrome has no problem with relative path’s though… Haven’t tested for Firefox.
3. The actual search is performed locally via JS. So it still takes a few hundred ms on my machine to load and render the page and finally preparing and executing the search with JS. Again: A consequence of static html files and I understand that generating static html is not bad. Nevertheless: Maybe there is a better way to do that… we could add an option to rustdoc to specify a non local search provider… Something like that. Would be great for the official documentation at least. The `search-index.js` for the official documentation is 1MB already…

I know that you all have probably more important things to do right now, but still: Any ideas/comments?

---

<div class="post-metadata">

**Author:** ![kevinmehall](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kevinmehall/32/2079_2.png) [@kevinmehall](https://internals.rust-lang.org/u/kevinmehall)\
**Post date:** [February 19, 2015, 6:59am UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612/7 "2015-02-19T06:59:34Z")

</div>

You can right click the search field and “Add a keyword for this search” (Firefox) or “Add as search engine” (Chrome). I’ve set the keyword to `rs`, so I can type e.g. `rs iterator`, `<enter>` to quickly get to the search results page.

Even though the search happens client side, the URLs are of the form [http://doc.rust-lang.org/std/?search=foo](http://doc.rust-lang.org/std/?search=foo) as if the server handled the search. The returned HTML is the same, and you’ll see the main page briefly appear before the JS parses the query string and runs the search.

---

<div class="post-metadata">

**Author:** ![LukasKalbertodt](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/lukaskalbertodt/32/2883_2.png) [@LukasKalbertodt](https://internals.rust-lang.org/u/LukasKalbertodt)\
**Post date:** [February 19, 2015, 12:35pm UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612/8 "2015-02-19T12:35:48Z")

</div>

I didn’t knew the “keyword” feature of Chrome, thanks for that. But I think most users don’t know about it and don’t want to manually set the search engine.

Sure, there is a query URL for that. I still don’t like the “brief” moment before the search results appear. But as already said: Not really possible with static HTML.

Since this is real low priority, I will just look if I can add a small “button” that will trigger a JS function trying to add the search provider to the browser. I think this should be possible somehow.

---

<div class="post-metadata">

**Author:** ![Folyd](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/folyd/32/5801_2.png) [@Folyd](https://internals.rust-lang.org/u/Folyd)\
**Post date:** [November 29, 2018, 4:24am UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612/9 "2018-11-29T04:24:18Z")

</div>

Hi, I think my extension is what you need. 😊

[https://internals.rust-lang.org/t/a-handy-browser-extension-to-search-crates-and-official-docs-in-address-bar-omnibox/](https://internals.rust-lang.org/t/a-handy-browser-extension-to-search-crates-and-official-docs-in-address-bar-omnibox/)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [March 25, 2019, 8:23am UTC](https://internals.rust-lang.org/t/documentation-search-engine-chrome-quick-search/1612/10 "2019-03-25T08:23:56Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
