interactivethings / catalog

Create living style guides using Markdown or React
https://www.catalog.style/
BSD 3-Clause "New" or "Revised" License
1.59k stars 145 forks source link

Search #108

Open bldng opened 8 years ago

bldng commented 8 years ago

Allow searching for pages, components and documentation within catalog.

bebraw commented 8 years ago

You could achieve this with lunr. You would need to implement an indexer and set up a loading mechanism so that the frontend fetches the index when it's needed. I have related discussion here.

There are also certain external solutions like Algolia that could work.

grossbart commented 8 years ago

Thanks for these suggestions, very interesting!

I have this idea in my head that the index can just be added as an additional property to the configuration and then be used in the client. This would keep Catalog free from any server-side requirements. As far as I understand a lunr index is just a static file, so that would actually be possible and we could load that file on demand.

bebraw commented 8 years ago

As far as I understand a lunr index is just a static file, so that would actually be possible and we could load that file on demand.

That's correct. I do exactly this at the book chapter I linked to. You can see the technique quite a bit in the wild. For instance Gitbook relies on it if I remember right.

jstcki commented 8 years ago

https://community.algolia.com/docsearch/ could maybe work too.

StephenOTT commented 7 years ago

Anyone have progress on this?

jstcki commented 7 years ago

@StephenOTT On search in general or any particular solution (e.g. Algolia integration)?

I haven't worked on this, as the problem definition has been quite fuzzy. There's a big difference in

If you can outline specific needs, this will help in prioritizing this feature.

StephenOTT commented 7 years ago

Was looking at in-page search solutions (not external).

Page title would be a good start. Another one that I was looking at was index of Page titles + headers.

jstcki commented 7 years ago

Okay, thanks! Doing this without up-front indexing might prove difficult, since (Markdown) pages are loaded asynchronously. The only way besides eagerly loading all content would be to have a build step which creates such an index.

jstcki commented 7 years ago

The question is if Catalog should provide that out-of-the-box or if there "just" needs to be an insertion point for something like lunr.

StephenOTT commented 7 years ago

I was thinking something like:

Option 1: On first load, index step occurs (maybe as a web worker?) Option 2: locally (or CI/or wherever), someone runs a standalone 'task' that generates a 'index file', and that index file is deployed with along with the html, js, assets, and md files.

bnhovde commented 7 years ago

We're also seeing a need for something like this as the "Components" folder is getting quite large. A simple "title" search/filter at the top of the sidebar would make sense in my head. This could be as simple as showing/hiding <li> elements in the sidebar as you type.

Quick and dirty example:

image

oyeanuj commented 7 years ago

I'd also recommend using something like js-worker-search - something I've used for similar cases that works efficiently.

MarkMurphy commented 7 years ago

This could probably be cleaned up a little bit but here's a basic implementation that simply filters the menu items as @bnhovde suggested above.

https://github.com/MarkMurphy/catalog/tree/search

Happy to turn this into a pull request.

kyleoliveiro commented 6 years ago

What do we need in order to move this along? IMO, search is a crucial feature for a style guide that's intended to be used by multiple parties.

ryandoesdesign commented 6 years ago

Have you made any progress with that PR, @MarkMurphy?

ryandoesdesign commented 6 years ago

There is also an open PR which needs some more discussion: #313

egdbear commented 6 years ago

As i can see this is not still implemented. @herrstucki @rtessier is there a need still to implement this?
I am willing to do it.

jhoffmcd commented 5 years ago

Just chiming in also on this feature. I love this lib for design system documentation, and if feels like a lack of search is holding it back from being a top go to lib for a lot of teams. Is there any way to iterate on this idea? Start small and make page content filterable, like @bnhovde mentioned? It looks like #313 solves for this.

Maybe this is being included in version 4?

robert-jelenic commented 4 years ago

I agree, Search feels like such a foundational piece of functionality that I'm sure it would hold a lot of teams back from adopting Catalog. Any new thinking on this feature? Looks like it's gone dormant.... 😔