dart-lang/dartdoc

Find as you type search

Closed this issue · 27 comments

A developer should be able to "find as you type" to locate docs for classes, libraries, fields, methods, functions, statics.

From dart-archive/dartdoc-viewer#38

Prefer names on the current page, when finding answers.

A user would like a shortcut key to easily access the search/find-as-you-type.

See dart-archive/dartdoc-viewer#43

For an example, see how Google Docs works. Cmd-F opens an app-specific search box.

From dart-archive/dartdoc-viewer#66

When searching for names, prefer definitions over mentions in text.

From dart-archive/dartdoc-viewer#102

(1) suggest should have a smarter ranking. dart:math's max is more popular than dart:html's.
(2) there needs to be some way of discovering every max function, popular or not,
like the wikipedia disambiguation pages.

Thought: we can parse all of pub.dartlang.org and generate a ranking of most used SDK APIs to help better inform ranking.

See also dart-archive/dartdoc-viewer#83

if I type something like "Node.remove" in the search box, it would be nice if dart:html Node.remove was the first result. The old doc viewer supported this, and I thought DartDocViewer did too, so not sure if this is a regression or a feature request. Either way, it would be super helpful :)

See also dart-archive/dartdoc-viewer#107

A request to be able to search for doc-related annotations. In Angular's case, search for all classes marked with ng-class.

Suggestions from @johnmccutchan

Allow a developer to use modifiers in search, e.g.:

extends:Element

implements:Pattern

is:method

Feedback from beta is that people really want this. Bumping up.

Started with #799

By default, the search box does this on mobile:

screen shot 2015-08-10 at 10 14 58 am

cc @devoncarew @keertip

of course, we can change this. Thoughts?

here it is on desktop:

screen shot 2015-08-10 at 10 15 42 am

Looks nice! I've also seen the search box replace either the entire top line or most of the top line.

If it replaces the top line, we lose the "what am I looking at" signal, though.

Looks good!

As in, there's a little search icon on the right, clicking on it pops out the search box - covering the header. Dismissing the search would recover the space for the regular header.

As in, there's a little search icon on the right, clicking on it pops out the search box

Ah, sure, we can try that.

Making progress.

screen shot 2015-08-10 at 10 05 53 pm

Looks good!

PR is ready. Will need tweaks, but I think it's enough to get feedback from real users.

Testing on the core SDK, it's clear we need to rank these. Will look at the previous logic.

screen shot 2015-08-12 at 8 56 02 am

Here's the scoring/weighting from the current api.dartlang.org: https://github.com/dart-lang/dartdoc-viewer/blob/master/client/lib/search.dart#L83

We now have basic weighting/sorting:

screen shot 2015-08-12 at 11 25 43 pm

Even better, shorter name is preferred:

screen shot 2015-08-12 at 11 37 00 pm

Nice! 👍

First cut of this is done. Room for improvement, so please try it out and send feedback!

Awesome! One small gotcha: when you're done generating the doc, dartdoc writes:

Success! Open file:///.../doc/api/index.html

But when you do this the search box is unavailable because the browser refuses to load the JSON index file. Maybe the message should mention this somehow. (Maybe it could say something like "run python -m SimpleHttpClient in .../doc/ and point you browser to http://localhost:8000", which would work for most users.)

That's a really good point! Please open a new issue so we can address this.

Created #819.