govhackaustralia / govhackaustralia.github.io

Project Jabberwocky: The data portal and handbook for GovHack
http://portal.govhack.org
Creative Commons Attribution 4.0 International
5 stars 7 forks source link

How do we do search? #31

Open keithamoss opened 8 years ago

keithamoss commented 8 years ago

Quoth @jesserobertson in #21 -

"I mostly stuck that in so that people could find their way back easily to something specific - it's easier to think "that animal dataset" than remember the ALA."

To what level - if at all - do we need to enable user's to search within this thing?

maxious commented 8 years ago

You can do reasonably good searching in real time in a browser with http://lunrjs.com/ ( for jekyll, you can even precompute the index https://github.com/slashdotdash/jekyll-lunr-js-search )

... you would need the word "animal" somehow associated though. metadata!

keithamoss commented 8 years ago

Nice tip, thanks Alex!

Hmm..either I'm missing something or it's lacking detail on how to configure what it pulls into the Lunr.js JSON file. Or does it pull everything it can? (e.g. Pull the tags, description, and content data from all of these collections, but ignore all of the other YAML frontmatter metadata.)

maxious commented 8 years ago

https://github.com/slashdotdash/jekyll-lunr-js-search/blob/master/build/jekyll_lunr_js_search.rb#L69 is what you put inside your jekyll project to be run each build, you could customise around line 69 to take different attributes from each item and change https://github.com/slashdotdash/jekyll-lunr-js-search/blob/master/build/jekyll_lunr_js_search.rb#L133 to include data collections rather than pages/posts?