18F / jekyll_pages_api_search

DEPRECATED - Jekyll search plugin based on lunr.js and jekyll_pages_api
https://rubygems.org/gems/jekyll_pages_api_search
Other
39 stars 8 forks source link

[DO NOT MERGE] Remove dependency on angular-livesearch, part 1 #9

Closed mbland closed 8 years ago

mbland commented 8 years ago

When this PR is ready for merge, I'll remove [DO NOT MERGE] from the title and ping the thread.

cc: @andrewmaier @catherinedevlin @mtorres253 @ertzeid @ccostino @melodykramer

This new implementation removes the dependency on angular-livesearch and Angular.js in general. It's not yet complete; the UI elements for selecting results need to be completely replaced. However, the mechanics of fetching and loading the Lunr.js index and retrieving search results from the input box is completely intact, illustrated by console messages.

The size of the new search bundle is now:

$ ls -l assets/js/ total 64 -rw-r--r-- 1 ... ... 16479 Jan 28 18:46 search-bundle.js -rw-r--r-- 1 ... ... 5360 Jan 28 18:46 search-bundle.js.gz -rw-r--r-- 1 ... ... 2940 Jan 28 18:46 search.js

Compared to the previous implementation, this is a 9x reduction in the uncompressed bundle size, 10x reduction in the compressed bundle size:

$ ls -l .../jekyll_pages_api_search-0.3.0/assets/js total 424 -rw-r--r-- 1 ... ... 151846 Aug 20 07:30 search-bundle.js -rw-r--r-- 1 ... ... 54514 Aug 20 07:30 search-bundle.js.gz -rw-r--r-- 1 ... ... 2842 Aug 20 07:30 search.js

The first image shows the fetching of Lunr.js results in the console; the second image shows the TODO message printed on "enter", indicating the spot where the new UI needs to be integrated.

search-results-in-console

todo-message-on-enter-in-console

mbland commented 8 years ago

Heh, yeah, we'll have to figure out that Travis/Coveralls failure, too. :stuck_out_tongue:

mbland commented 8 years ago

Development instructions might be nice:

$ git clone git@github.com:18F/guides-template.git [or ./go update_theme in an existing clone]
$ git clone git@github.com:18F/jekyll_pages_api_search.git

$ cd jekyll_pages_api_search
$ git fetch origin reimplement-search-ui
$ git checkout !$
$ bundle install
$ bundle exec rake build [do this every time you change something in jekyll_pages_api_search]

$ cd ../guides-template
$ [add "gem jekyll_pages_api_search, path: '../jekyll_pages_api_search'" to :jekyll_plugins section of  Gemfile ]
$ bundle install
$ ./go serve [and open browser to http://localhost:4000/]
mbland commented 8 years ago

Closing this PR, as it's been superseded by #15.