Closed KittyGiraudel closed 10 years ago
This could be done completely client-side, within the DOM, but @valeriangalliat and I wished to have something a little more focused on data rather than presentation.
I think exposing the whole data to the client side would be great.
So injecting the data
using swig
<script>window.data = {{ data | json }}</script>
is easy. Using http://lunrjs.com/ to index appropriate keys (like name, description).
After trying to injecting the whole data into the page I think that it is to much. Here is an DOM approach using fuse.js and injecting only item.context.type
and item.context.name
into the DOM.
Development is on branch add-search-fuzzy-dom
Unstyled showcase can be found here: http://0da9e3a.5minfork.com/examples/dist/
A word regarding inline-search (items get filtered and hidden/displayed as you're typing):
On paper, I like that. It does the job well since I automatically get rid of all the items I don't want as I'm typing in the search bar. That's what we have at Browserhacks and it's working pretty well.
There are 2 things I don't like with this system though:
I'd rather keep things simple: I type, I get suggestions, I pick one and get redirected to the selected item (anchor in our case).
Fixed by 06576f57eba413be514497070d5e90930c9ec292
Would be cool to be able to search and filter documented items.