aframevr / aframe-site

:a: Official A-Frame site.
https://aframe.io/
MIT License
99 stars 143 forks source link

Add search for docs #185

Closed cvan closed 8 years ago

ngokevin commented 8 years ago

What tools/services do you have in mind? Algolia?

cvan commented 8 years ago

lunr I'm familiar and comfortable with. could use a third-party etc.

to set up, add this to _config.yml:

# Lunr
## https://github.com/o2team/hexo-generator-lunr
## http://lunrjs.com/
lunr:
  field: all
  fulltext: true
  path: lunr/
ngokevin commented 8 years ago

I have a working prototype of Lunr, but it's a bit wanting. It'll just return a list of matching pages, which is an MVP...but it seems the UX of Algolia is worth it. It returns the matching excerpt from the content, and we'd be able to index as much as we wanted (including blog posts) on their service without worrying about frontend bundle (currently 1.7MB per each doc version). And the biggies, React and Vue.js are using it.

cvan commented 8 years ago

Here are some Hexo projects that use some custom search plugin for Hexo called Insight:

https://github.com/ppoffice/hexo-theme-hueman (demo) https://github.com/ppoffice/hexo-theme-icarus (demo)

I haven't tested whether it's better than lunr is. Was lunr/elasticlunr not returning decent enough results, or what was the problem?

ngokevin commented 8 years ago

Well I mentioned it in the above comment, it requires a 1.7MB download of the entire index and store (that's just for each version of the doc). And we're not able to show the matching excerpt for each search result, a pure client-side solution won't be able to do this reasonably, we need a service.

cvan commented 8 years ago

Well I mentioned it in the above comment, it requires a 1.7MB download of the entire index and store (that's just for each version of the doc). And we're not able to show the matching excerpt for each search result, a pure client-side solution won't be able to do this reasonably, we need a service.

You can download it asynchronously in a worker and cache it in a Service Worker. You can also set up a Node REST API server using lunr.js. Whatever works best.

ngokevin commented 8 years ago

Still not able to show the matched line.