{"action":"created","issue":{"url":"https://api.github.com/repos/yahoo/fluxible.io/issues/127","labels_url":"https://api.github.com/repos/yahoo/fluxible.io/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/yahoo/fluxible.io/issues/127/comments","events_url":"https://api.github.com/repos/yahoo/fluxible.io/issues/127/events","html_url":"https://github.com/yahoo/fluxible.io/pull/127","id":80788044,"number":127,"title":"Add client side search capabilities","user":{"login":"redonkulus","id":193272,"avatar_url":"https://avatars.githubusercontent.com/u/193272?v=3","gravatar_id":"","url":"https://api.github.com/users/redonkulus","html_url":"https://github.com/redonkulus","followers_url":"https://api.github.com/users/redonkulus/followers","following_url":"https://api.github.com/users/redonkulus/following{/other_user}","gists_url":"https://api.github.com/users/redonkulus/gists{/gist_id}","starred_url":"https://api.github.com/users/redonkulus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redonkulus/subscriptions","organizations_url":"https://api.github.com/users/redonkulus/orgs","repos_url":"https://api.github.com/users/redonkulus/repos","events_url":"https://api.github.com/users/redonkulus/events{/privacy}","received_events_url":"https://api.github.com/users/redonkulus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yahoo/fluxible.io/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-26T04:42:17Z","updated_at":"2015-05-26T04:42:18Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/yahoo/fluxible.io/pulls/127","html_url":"https://github.com/yahoo/fluxible.io/pull/127","diff_url":"https://github.com/yahoo/fluxible.io/pull/127.diff","patch_url":"https://github.com/yahoo/fluxible.io/pull/127.patch"},"body":"@lingyan @mridgway @Vijar \r\n\r\nFixes #78. This PR provides support for client side search using [lunrjs](http://lunrjs.com/). Read below to see how it works.\r\n\r\n## Creating the index\r\nOn server start, the `docs service` creates a lunr.js index and adds each markdown document to the index. The index is then serialized and saved to the `/build/search.json` file, so it can be used on the client (its about ~1mb, maybe too large to dehydrate from a store). \r\n\r\n## Loading the index\r\nOn the client, the new `Search.jsx` component has a `componentDidMount` lifecycle event which fires a `LOAD_INDEX` action. This action will call the `search service`. The `search service` reads the `/build/search.json` lunr.js index file and returns that to the action. The `RECEIVE_INDEX` action is then fired, with this payload. The `SearchStore` listens to `RECEIVE_INDEX` and stores the index in the store.\r\n\r\n## Performing a search\r\nThe `Search.jsx` component contains an input field that is displayed when the search icon is clicked. After the search query is inputed and `ENTER` is pressed, the `navigateAction` event is fired to load the new `/search.html` page (we use the `navigateAction` to save the query in the browser history). The `/search.html` route uses the `showSearch` action to fire the `DO_SEARCH` action (with query passed for the payload). The `SearchStore` uses the query to perform a search on the lunr.js index. State is stored and `emitChange` is called. The `Docs` component listens to change events from the `SearchStore` and renders the `SearchResults` component to display search results.\r\n\r\n## Watch is in action\r\nhttps://www.youtube.com/watch?v=kCqa2ELcG4Y\r\n\r\n## Todo\r\nI still need to add unit and functional tests but wanted to get some eyes on it now."},"comment":{"url":"https://api.github.com/repos/yahoo/fluxible.io/issues/comments/105390618","html_url":"https://github.com/yahoo/fluxible.io/pull/127#issuecomment-105390618","issue_url":"https://api.github.com/repos/yahoo/fluxible.io/issues/127","id":105390618,"user":{"login":"yahoocla","id":6155154,"avatar_url":"https://avatars.githubusercontent.com/u/6155154?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoocla","html_url":"https://github.com/yahoocla","followers_url":"https://api.github.com/users/yahoocla/followers","following_url":"https://api.github.com/users/yahoocla/following{/other_user}","gists_url":"https://api.github.com/users/yahoocla/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoocla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoocla/subscriptions","organizations_url":"https://api.github.com/users/yahoocla/orgs","repos_url":"https://api.github.com/users/yahoocla/repos","events_url":"https://api.github.com/users/yahoocla/events{/privacy}","received_events_url":"https://api.github.com/users/yahoocla/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T04:42:18Z","updated_at":"2015-05-26T04:42:18Z","body":"CLA is valid!"}}