I've spent couple of hours during the last days with implementing an ElasticSearch-backed search for the ES website (so it could be “self-hosted”, so to speak), as we have been talking about it on IRC the other day.
First, you can try the functionality here:
The query is passed directly as a query string parameter to ES, so you can try any Lucene-compatible query.
The code for the demo is available here: https://github.com/karmi/elasticsearch.github.com/compare/elasticsearch%3Amaster...search. The autocomplete + results display is done with heavily stylized jQuery-UI Autocomplete. It's kinda invasive, but works. Would be nice to rewrite it, though.
The content was insterted into ES with this Ruby library: https://github.com/karmi/hide, it leverages the Jekyll gem to gather info about the pages, so the usage is trivial. It uses the https://github.com/karmi/slingshot gem to insert docs into ES (see https://github.com/karmi/hide/blob/master/lib/hide/indexer.rb).
For the real use, I think the following would need to be done:
- Get hold of some VPS or other server to run the ES server. This is the least of a problem, either me or @clintongormley can provide one.
- A redesign of the results window, color-differentiate the different categories (blog, guide)
- Displaying a highlight of term instead of URL
- Creating an HTTP endpoint for Github post-receive hook, which pulls new content from Github whenever there's a push into the repo, and re-indexes accordingly.
For the optimal case, it would be nice to have checkboxes to allow search in "guides" etc only, @lukasvlcek suggested indexing also Github issues, it would be nice to have prettier GUI, etc etc etc.
What does everybody think, is it worthwile to continue with this? Any ideas, suggestions?