{"action":"closed","number":456,"pull_request":{"url":"https://api.github.com/repos/nusmodifications/nusmods/pulls/456","id":144579407,"html_url":"https://github.com/nusmodifications/nusmods/pull/456","diff_url":"https://github.com/nusmodifications/nusmods/pull/456.diff","patch_url":"https://github.com/nusmodifications/nusmods/pull/456.patch","issue_url":"https://api.github.com/repos/nusmodifications/nusmods/issues/456","number":456,"state":"closed","locked":false,"title":"Module search","user":{"login":"ZhangYiJiang","id":445650,"avatar_url":"https://avatars0.githubusercontent.com/u/445650?v=4","gravatar_id":"","url":"https://api.github.com/users/ZhangYiJiang","html_url":"https://github.com/ZhangYiJiang","followers_url":"https://api.github.com/users/ZhangYiJiang/followers","following_url":"https://api.github.com/users/ZhangYiJiang/following{/other_user}","gists_url":"https://api.github.com/users/ZhangYiJiang/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhangYiJiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhangYiJiang/subscriptions","organizations_url":"https://api.github.com/users/ZhangYiJiang/orgs","repos_url":"https://api.github.com/users/ZhangYiJiang/repos","events_url":"https://api.github.com/users/ZhangYiJiang/events{/privacy}","received_events_url":"https://api.github.com/users/ZhangYiJiang/received_events","type":"User","site_admin":false},"body":"This closes #142 \r\n\r\n![peek 2017-10-03 20-50](https://user-images.githubusercontent.com/445650/31159509-36cdbada-a8fc-11e7-9913-df791db2e38d.gif)\r\n\r\n### Performance \r\n\r\nSearching is done entirely on the client side. Performance is acceptable even without any sort of fancy indexing - just plain `String#includes` - the slowest part of the operation is actually rendering. On mobile we may need to disable 'instant' search, but again the performance is actually really good. \r\n\r\nNote that there is more stuttering in development due to Redux logger. The gif above was recorded against a production build. \r\n\r\n### Implementation \r\n\r\nSearch is implemented as a filter. This means it plays nice with the rest of the filters, although the code is slightly awkward. The search box keeps the search string in local state and only pushes it into the Redux store on a throttle. This improves perceived responsiveness because rendering is not triggered directly by user input events. \r\n\r\nThe Redux store is also useful because the search term highlighting requires the search term, but only several components deeper in the component tree, so pushing it down from the topmost component would be rather awkward. \r\n\r\n### To do\r\n\r\n- [x] Sorting by relevance: The current implementation makes this a little awkward, but I think it should be possible by assigning each module a score in `moduleSearch()` based on where the token appears (module code and title are 'worth' more), and `<ModuleFinderContainer>` can keep in its state to sort the modules by. \r\n\r\n- [ ] Better tokenization: Currently tokens are generated by a simple `String#split`, but that means things like `\"science fiction\"` (notice the quotation marks) will be treated as two words. It should be easy enough to treat things in quotes as verbatim tokens \r\n","created_at":"2017-10-04T04:16:39Z","updated_at":"2017-12-04T05:58:38Z","closed_at":"2017-12-04T05:58:38Z","merged_at":"2017-12-04T05:58:38Z","merge_commit_sha":"c7a504b323f6da701575f1d246c50fc6c4c06320","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/nusmodifications/nusmods/pulls/456/commits","review_comments_url":"https://api.github.com/repos/nusmodifications/nusmods/pulls/456/comments","review_comment_url":"https://api.github.com/repos/nusmodifications/nusmods/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nusmodifications/nusmods/issues/456/comments","statuses_url":"https://api.github.com/repos/nusmodifications/nusmods/statuses/f541c65e00e62f305387a1b546b56aea72df651b","head":{"label":"nusmodifications:module-search","ref":"module-search","sha":"f541c65e00e62f305387a1b546b56aea72df651b","user":{"login":"nusmodifications","id":7428865,"avatar_url":"https://avatars3.githubusercontent.com/u/7428865?v=4","gravatar_id":"","url":"https://api.github.com/users/nusmodifications","html_url":"https://github.com/nusmodifications","followers_url":"https://api.github.com/users/nusmodifications/followers","following_url":"https://api.github.com/users/nusmodifications/following{/other_user}","gists_url":"https://api.github.com/users/nusmodifications/gists{/gist_id}","starred_url":"https://api.github.com/users/nusmodifications/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nusmodifications/subscriptions","organizations_url":"https://api.github.com/users/nusmodifications/orgs","repos_url":"https://api.github.com/users/nusmodifications/repos","events_url":"https://api.github.com/users/nusmodifications/events{/privacy}","received_events_url":"https://api.github.com/users/nusmodifications/received_events","type":"Organization","site_admin":false},"repo":{"id":5481861,"name":"nusmods","full_name":"nusmodifications/nusmods","owner":{"login":"nusmodifications","id":7428865,"avatar_url":"https://avatars3.githubusercontent.com/u/7428865?v=4","gravatar_id":"","url":"https://api.github.com/users/nusmodifications","html_url":"https://github.com/nusmodifications","followers_url":"https://api.github.com/users/nusmodifications/followers","following_url":"https://api.github.com/users/nusmodifications/following{/other_user}","gists_url":"https://api.github.com/users/nusmodifications/gists{/gist_id}","starred_url":"https://api.github.com/users/nusmodifications/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nusmodifications/subscriptions","organizations_url":"https://api.github.com/users/nusmodifications/orgs","repos_url":"https://api.github.com/users/nusmodifications/repos","events_url":"https://api.github.com/users/nusmodifications/events{/privacy}","received_events_url":"https://api.github.com/users/nusmodifications/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nusmodifications/nusmods","description":"🏫 Unofficial course planning platform for National University of Singapore.","fork":false,"url":"https://api.github.com/repos/nusmodifications/nusmods","forks_url":"https://api.github.com/repos/nusmodifications/nusmods/forks","keys_url":"https://api.github.com/repos/nusmodifications/nusmods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nusmodifications/nusmods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nusmodifications/nusmods/teams","hooks_url":"https://api.github.com/repos/nusmodifications/nusmods/hooks","issue_events_url":"https://api.github.com/repos/nusmodifications/nusmods/issues/events{/number}","events_url":"https://api.github.com/repos/nusmodifications/nusmods/events","assignees_url":"https://api.github.com/repos/nusmodifications/nusmods/assignees{/user}","branches_url":"https://api.github.com/repos/nusmodifications/nusmods/branches{/branch}","tags_url":"https://api.github.com/repos/nusmodifications/nusmods/tags","blobs_url":"https://api.github.com/repos/nusmodifications/nusmods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nusmodifications/nusmods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nusmodifications/nusmods/git/refs{/sha}","trees_url":"https://api.github.com/repos/nusmodifications/nusmods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nusmodifications/nusmods/statuses/{sha}","languages_url":"https://api.github.com/repos/nusmodifications/nusmods/languages","stargazers_url":"https://api.github.com/repos/nusmodifications/nusmods/stargazers","contributors_url":"https://api.github.com/repos/nusmodifications/nusmods/contributors","subscribers_url":"https://api.github.com/repos/nusmodifications/nusmods/subscribers","subscription_url":"https://api.github.com/repos/nusmodifications/nusmods/subscription","commits_url":"https://api.github.com/repos/nusmodifications/nusmods/commits{/sha}","git_commits_url":"https://api.github.com/repos/nusmodifications/nusmods/git/commits{/sha}","comments_url":"https://api.github.com/repos/nusmodifications/nusmods/comments{/number}","issue_comment_url":"https://api.github.com/repos/nusmodifications/nusmods/issues/comments{/number}","contents_url":"https://api.github.com/repos/nusmodifications/nusmods/contents/{+path}","compare_url":"https://api.github.com/repos/nusmodifications/nusmods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nusmodifications/nusmods/merges","archive_url":"https://api.github.com/repos/nusmodifications/nusmods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nusmodifications/nusmods/downloads","issues_url":"https://api.github.com/repos/nusmodifications/nusmods/issues{/number}","pulls_url":"https://api.github.com/repos/nusmodifications/nusmods/pulls{/number}","milestones_url":"https://api.github.com/repos/nusmodifications/nusmods/milestones{/number}","notifications_url":"https://api.github.com/repos/nusmodifications/nusmods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nusmodifications/nusmods/labels{/name}","releases_url":"https://api.github.com/repos/nusmodifications/nusmods/releases{/id}","deployments_url":"https://api.github.com/repos/nusmodifications/nusmods/deployments","created_at":"2012-08-20T13:58:35Z","updated_at":"2017-11-28T08:23:49Z","pushed_at":"2017-12-04T05:58:38Z","git_url":"git://github.com/nusmodifications/nusmods.git","ssh_url":"git@github.com:nusmodifications/nusmods.git","clone_url":"https://github.com/nusmodifications/nusmods.git","svn_url":"https://github.com/nusmodifications/nusmods","homepage":"https://nusmods.com","size":6584,"stargazers_count":160,"watchers_count":160,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":83,"mirror_url":null,"archived":false,"open_issues_count":78,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":83,"open_issues":78,"watchers":160,"default_branch":"master"}},"base":{"label":"nusmodifications:master","ref":"master","sha":"bc14824fe068391ca4d7da224b21ae6bd65963d4","user":{"login":"nusmodifications","id":7428865,"avatar_url":"https://avatars3.githubusercontent.com/u/7428865?v=4","gravatar_id":"","url":"https://api.github.com/users/nusmodifications","html_url":"https://github.com/nusmodifications","followers_url":"https://api.github.com/users/nusmodifications/followers","following_url":"https://api.github.com/users/nusmodifications/following{/other_user}","gists_url":"https://api.github.com/users/nusmodifications/gists{/gist_id}","starred_url":"https://api.github.com/users/nusmodifications/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nusmodifications/subscriptions","organizations_url":"https://api.github.com/users/nusmodifications/orgs","repos_url":"https://api.github.com/users/nusmodifications/repos","events_url":"https://api.github.com/users/nusmodifications/events{/privacy}","received_events_url":"https://api.github.com/users/nusmodifications/received_events","type":"Organization","site_admin":false},"repo":{"id":5481861,"name":"nusmods","full_name":"nusmodifications/nusmods","owner":{"login":"nusmodifications","id":7428865,"avatar_url":"https://avatars3.githubusercontent.com/u/7428865?v=4","gravatar_id":"","url":"https://api.github.com/users/nusmodifications","html_url":"https://github.com/nusmodifications","followers_url":"https://api.github.com/users/nusmodifications/followers","following_url":"https://api.github.com/users/nusmodifications/following{/other_user}","gists_url":"https://api.github.com/users/nusmodifications/gists{/gist_id}","starred_url":"https://api.github.com/users/nusmodifications/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nusmodifications/subscriptions","organizations_url":"https://api.github.com/users/nusmodifications/orgs","repos_url":"https://api.github.com/users/nusmodifications/repos","events_url":"https://api.github.com/users/nusmodifications/events{/privacy}","received_events_url":"https://api.github.com/users/nusmodifications/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nusmodifications/nusmods","description":"🏫 Unofficial course planning platform for National University of Singapore.","fork":false,"url":"https://api.github.com/repos/nusmodifications/nusmods","forks_url":"https://api.github.com/repos/nusmodifications/nusmods/forks","keys_url":"https://api.github.com/repos/nusmodifications/nusmods/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nusmodifications/nusmods/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nusmodifications/nusmods/teams","hooks_url":"https://api.github.com/repos/nusmodifications/nusmods/hooks","issue_events_url":"https://api.github.com/repos/nusmodifications/nusmods/issues/events{/number}","events_url":"https://api.github.com/repos/nusmodifications/nusmods/events","assignees_url":"https://api.github.com/repos/nusmodifications/nusmods/assignees{/user}","branches_url":"https://api.github.com/repos/nusmodifications/nusmods/branches{/branch}","tags_url":"https://api.github.com/repos/nusmodifications/nusmods/tags","blobs_url":"https://api.github.com/repos/nusmodifications/nusmods/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nusmodifications/nusmods/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nusmodifications/nusmods/git/refs{/sha}","trees_url":"https://api.github.com/repos/nusmodifications/nusmods/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nusmodifications/nusmods/statuses/{sha}","languages_url":"https://api.github.com/repos/nusmodifications/nusmods/languages","stargazers_url":"https://api.github.com/repos/nusmodifications/nusmods/stargazers","contributors_url":"https://api.github.com/repos/nusmodifications/nusmods/contributors","subscribers_url":"https://api.github.com/repos/nusmodifications/nusmods/subscribers","subscription_url":"https://api.github.com/repos/nusmodifications/nusmods/subscription","commits_url":"https://api.github.com/repos/nusmodifications/nusmods/commits{/sha}","git_commits_url":"https://api.github.com/repos/nusmodifications/nusmods/git/commits{/sha}","comments_url":"https://api.github.com/repos/nusmodifications/nusmods/comments{/number}","issue_comment_url":"https://api.github.com/repos/nusmodifications/nusmods/issues/comments{/number}","contents_url":"https://api.github.com/repos/nusmodifications/nusmods/contents/{+path}","compare_url":"https://api.github.com/repos/nusmodifications/nusmods/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nusmodifications/nusmods/merges","archive_url":"https://api.github.com/repos/nusmodifications/nusmods/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nusmodifications/nusmods/downloads","issues_url":"https://api.github.com/repos/nusmodifications/nusmods/issues{/number}","pulls_url":"https://api.github.com/repos/nusmodifications/nusmods/pulls{/number}","milestones_url":"https://api.github.com/repos/nusmodifications/nusmods/milestones{/number}","notifications_url":"https://api.github.com/repos/nusmodifications/nusmods/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nusmodifications/nusmods/labels{/name}","releases_url":"https://api.github.com/repos/nusmodifications/nusmods/releases{/id}","deployments_url":"https://api.github.com/repos/nusmodifications/nusmods/deployments","created_at":"2012-08-20T13:58:35Z","updated_at":"2017-11-28T08:23:49Z","pushed_at":"2017-12-04T05:58:38Z","git_url":"git://github.com/nusmodifications/nusmods.git","ssh_url":"git@github.com:nusmodifications/nusmods.git","clone_url":"https://github.com/nusmodifications/nusmods.git","svn_url":"https://github.com/nusmodifications/nusmods","homepage":"https://nusmods.com","size":6584,"stargazers_count":160,"watchers_count":160,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":83,"mirror_url":null,"archived":false,"open_issues_count":78,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":83,"open_issues":78,"watchers":160,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nusmodifications/nusmods/pulls/456"},"html":{"href":"https://github.com/nusmodifications/nusmods/pull/456"},"issue":{"href":"https://api.github.com/repos/nusmodifications/nusmods/issues/456"},"comments":{"href":"https://api.github.com/repos/nusmodifications/nusmods/issues/456/comments"},"review_comments":{"href":"https://api.github.com/repos/nusmodifications/nusmods/pulls/456/comments"},"review_comment":{"href":"https://api.github.com/repos/nusmodifications/nusmods/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nusmodifications/nusmods/pulls/456/commits"},"statuses":{"href":"https://api.github.com/repos/nusmodifications/nusmods/statuses/f541c65e00e62f305387a1b546b56aea72df651b"}},"author_association":"COLLABORATOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"ZhangYiJiang","id":445650,"avatar_url":"https://avatars0.githubusercontent.com/u/445650?v=4","gravatar_id":"","url":"https://api.github.com/users/ZhangYiJiang","html_url":"https://github.com/ZhangYiJiang","followers_url":"https://api.github.com/users/ZhangYiJiang/followers","following_url":"https://api.github.com/users/ZhangYiJiang/following{/other_user}","gists_url":"https://api.github.com/users/ZhangYiJiang/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhangYiJiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhangYiJiang/subscriptions","organizations_url":"https://api.github.com/users/ZhangYiJiang/orgs","repos_url":"https://api.github.com/users/ZhangYiJiang/repos","events_url":"https://api.github.com/users/ZhangYiJiang/events{/privacy}","received_events_url":"https://api.github.com/users/ZhangYiJiang/received_events","type":"User","site_admin":false},"comments":9,"review_comments":12,"maintainer_can_modify":false,"commits":21,"additions":490,"deletions":37,"changed_files":23}}
{"actor":{"display_login":"ZhangYiJiang"}}