18F / hub

DEPRECATED: Documentation hub for the 18F team
https://github.com/18F/handbook
Other
46 stars 33 forks source link

Investigating client-side search #42

Closed mbland closed 9 years ago

mbland commented 9 years ago

Something along the lines of:

https://github.com/blog/1939-how-github-uses-github-to-document-github

afeld commented 9 years ago

https://github.com/PascalW/jekyll_indextank may be useful.

@jglovier @benbalter @gjtorikian We're looking to replicate how you implemented search (and for a similar purpose) as what you described in the blog post above...any chance the code that generates (and ideally, consumes) https://help.github.com/search/search.json is open source? If not, any interest in collaborating on a gem?

gjtorikian commented 9 years ago

It's all totally open-source!

We use lunrjs to build the search. A gem does exist to easily support it in Jekyll, but, it hasn't been updated for Jekyll 2.0, and is largely abandoned, I think.

But that's totally fine. Without the gem dependency, we can do all of this in native Jekyll, which makes it much easier to deploy to GHPages. Here's what we do:

Basically, search.json is a collection of all your site's content. Lunrjs uses this to create its index. And the template defines the layour for the search results.

In order to keep Lunrjs's indexing off the main thread, I made a search worker to do it off-thread: https://gist.github.com/gjtorikian/aed86fec6b266c3e4d46

....In typing all this out, I realize how convoluted this all probably is. :worried: Lemme know if you need more info.

afeld commented 9 years ago

@gjtorikian Super helpful, thanks!

FYI, started playing around with (a couple approaches for) generating the JSON in the search branch, which I plan to eventually move into a Jekyll plugin. Ran into a handful of issues – will submit a PR soon to solicit feedback.

jglovier commented 9 years ago

which I plan to eventually move into a Jekyll plugin

:heart_eyes:

afeld commented 9 years ago

Working on the pages API here: https://github.com/18F/hub/pull/69

afeld commented 9 years ago

A 3rd-party option: http://www.digitalgov.gov/services/search/ via @gbinal

gbinal commented 9 years ago

Thanks, @afeld. If time comes, I'm happy to make the argument for dogfooding that shared service.

mbland commented 9 years ago

Just added https://18f.gsa.gov/hub/ to DigitalGov.

gbinal commented 9 years ago

Thanks, @mbland. There's a couple ways to integrate the resulting site search, through basically a page that they pull in or through their search API. Holler if you all need any help or want to connect with the team that runs this. They are one of the more agile and responsive teams I know in gov't so it's a good connection for us to deepen.