elixir-lang/ex_doc

Proposal: Narrow search results by type

zachdaniel opened this issue · 10 comments

In this very poor mockup, I show an example UI that would allow for selecting the types of things you would like to search. I would imagine that by default they would all be checked, so we could also add a little "only" button next to each one to instantly select only that one.

CleanShot 2023-09-10 at 14 55 36@2x

This could be put behind a configuration of some kind, but to me it sounds generally useful enough to be done automatically. If this is something we would be interested in I'm happy to take a stab at it.

For some context, I'm trying to find ways to get hex docs to cover the cases that we need to (ideally) get rid of ash-hq.org (not the whole website, just the reference documentation features). Multi-package search is one major issue, but we have some strategies to help with that (leave our ash-hq multi-package search up, but have it link to hex. The other major issue is search ability of DSLs within hex. Worst case scenario we can't get rid of ash-hq.org, but will still have improved experience for those users who prefer to use hex :)

Hi Zach! We are exploring multi package search, which will require a UI redesign, then I think it is a good time to revamp this discussion.

something we could do right now though is to allow you to specific a type via keywords, something like: change type:function, but that’s not very discoverable. If you want to explore this, a PR is welcome.

Keywords sound like a good idea, and potentially are a good first solution, as any UI can be built on top of them and ultimately end up modifying the search string, even if it is hidden from the user. I will look at it now 👍

It also looks like lunr is used under the hood which already has keyword search. It may be as simple as exposing the key in some way :)

Closing in favor of PR.

@josevalim I'm not sure if this is something that I've screwed up or not, but if I point ex_doc at the main branch on the repo, I get some kind of strange javascript error that prevents me from scrolling the sidebar. I can't see any new js errors in the console either. Just letting you know.

Nope :) Happens on commits before you merged the changes from my PR, so this must just be a side effect of trying to use ex_doc from GitHub. I will wait for a release :)

Related to #1773 perhaps? Can you post your git sha in there and how you can reproduce the failure?

Yep! So the ex_doc_behavior branch on ash has this reproduced. Running mix docs yields a page w/ the sidebar not scrollable/extending off of the screen. I've tested in safari and chrome, on an M1 Mac.

ash-project/ash@2235c60

Fixed by #1776.