{"action":"created","comment":{"url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments/74138455","id":74138455,"diff_hunk":"@@ -54,8 +54,11 @@ def update_path\n   end\n \n   def self.search(query, params: {})\n-    sql_query = \"%#{query}%\"\n-    Post.where(\"world_readable = 1 AND (title LIKE :sql_query OR body LIKE :sql_query)\", sql_query: sql_query).order(created_at: :desc)\n+    posts = Post.where(\"world_readable = 1\")","path":"WcaOnRails/app/models/post.rb","position":6,"original_position":6,"commit_id":"8acb7f702c763814bd771b2a416f89585d7c6ef1","original_commit_id":"8acb7f702c763814bd771b2a416f89585d7c6ef1","user":{"login":"larspetrus","id":755243,"avatar_url":"https://avatars.githubusercontent.com/u/755243?v=3","gravatar_id":"","url":"https://api.github.com/users/larspetrus","html_url":"https://github.com/larspetrus","followers_url":"https://api.github.com/users/larspetrus/followers","following_url":"https://api.github.com/users/larspetrus/following{/other_user}","gists_url":"https://api.github.com/users/larspetrus/gists{/gist_id}","starred_url":"https://api.github.com/users/larspetrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larspetrus/subscriptions","organizations_url":"https://api.github.com/users/larspetrus/orgs","repos_url":"https://api.github.com/users/larspetrus/repos","events_url":"https://api.github.com/users/larspetrus/events{/privacy}","received_events_url":"https://api.github.com/users/larspetrus/received_events","type":"User","site_admin":false},"body":"Yeah, that's much better!","created_at":"2016-08-09T20:32:46Z","updated_at":"2016-08-09T20:32:46Z","html_url":"https://github.com/cubing/worldcubeassociation.org/pull/804#discussion_r74138455","pull_request_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/804","_links":{"self":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments/74138455"},"html":{"href":"https://github.com/cubing/worldcubeassociation.org/pull/804#discussion_r74138455"},"pull_request":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/804"}}},"pull_request":{"url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/804","id":80353653,"html_url":"https://github.com/cubing/worldcubeassociation.org/pull/804","diff_url":"https://github.com/cubing/worldcubeassociation.org/pull/804.diff","patch_url":"https://github.com/cubing/worldcubeassociation.org/pull/804.patch","issue_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/804","number":804,"state":"open","locked":false,"title":"Fix highlighting and searching","user":{"login":"jonatanklosko","id":17034772,"avatar_url":"https://avatars.githubusercontent.com/u/17034772?v=3","gravatar_id":"","url":"https://api.github.com/users/jonatanklosko","html_url":"https://github.com/jonatanklosko","followers_url":"https://api.github.com/users/jonatanklosko/followers","following_url":"https://api.github.com/users/jonatanklosko/following{/other_user}","gists_url":"https://api.github.com/users/jonatanklosko/gists{/gist_id}","starred_url":"https://api.github.com/users/jonatanklosko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonatanklosko/subscriptions","organizations_url":"https://api.github.com/users/jonatanklosko/orgs","repos_url":"https://api.github.com/users/jonatanklosko/repos","events_url":"https://api.github.com/users/jonatanklosko/events{/privacy}","received_events_url":"https://api.github.com/users/jonatanklosko/received_events","type":"User","site_admin":false},"body":"This does a couple of things:\r\n- Fixes highlighting of multi-part query like [this](https://www.worldcubeassociation.org/search?q=Jon%20sko) (as you can see it doesn't work now). I've fixed this by passing splitted query to the `wca_highlight`\r\n- Enables more flexible search for `Post` by splitting one query into a couple. This implies changes to `wca_excerpt` method which now behaves as follows:\r\n    - Finds first and last appearance of one of the query words\r\n    - Gets all the text between them\r\n    - Calls `excerpt` for this whole part\r\n    - Highlights query words in the excerpted text\r\n\r\nThe text I've added should be a good example of this.\r\nI hope the description makes sense.","created_at":"2016-08-06T23:27:57Z","updated_at":"2016-08-09T20:32:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"32e4151cdeecddcb07a8260562c057c6b37a8e85","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/804/commits","review_comments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/804/comments","review_comment_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/804/comments","statuses_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/8acb7f702c763814bd771b2a416f89585d7c6ef1","head":{"label":"jonatanklosko:fix-highlighting","ref":"fix-highlighting","sha":"8acb7f702c763814bd771b2a416f89585d7c6ef1","user":{"login":"jonatanklosko","id":17034772,"avatar_url":"https://avatars.githubusercontent.com/u/17034772?v=3","gravatar_id":"","url":"https://api.github.com/users/jonatanklosko","html_url":"https://github.com/jonatanklosko","followers_url":"https://api.github.com/users/jonatanklosko/followers","following_url":"https://api.github.com/users/jonatanklosko/following{/other_user}","gists_url":"https://api.github.com/users/jonatanklosko/gists{/gist_id}","starred_url":"https://api.github.com/users/jonatanklosko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonatanklosko/subscriptions","organizations_url":"https://api.github.com/users/jonatanklosko/orgs","repos_url":"https://api.github.com/users/jonatanklosko/repos","events_url":"https://api.github.com/users/jonatanklosko/events{/privacy}","received_events_url":"https://api.github.com/users/jonatanklosko/received_events","type":"User","site_admin":false},"repo":{"id":54846746,"name":"worldcubeassociation.org","full_name":"jonatanklosko/worldcubeassociation.org","owner":{"login":"jonatanklosko","id":17034772,"avatar_url":"https://avatars.githubusercontent.com/u/17034772?v=3","gravatar_id":"","url":"https://api.github.com/users/jonatanklosko","html_url":"https://github.com/jonatanklosko","followers_url":"https://api.github.com/users/jonatanklosko/followers","following_url":"https://api.github.com/users/jonatanklosko/following{/other_user}","gists_url":"https://api.github.com/users/jonatanklosko/gists{/gist_id}","starred_url":"https://api.github.com/users/jonatanklosko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonatanklosko/subscriptions","organizations_url":"https://api.github.com/users/jonatanklosko/orgs","repos_url":"https://api.github.com/users/jonatanklosko/repos","events_url":"https://api.github.com/users/jonatanklosko/events{/privacy}","received_events_url":"https://api.github.com/users/jonatanklosko/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jonatanklosko/worldcubeassociation.org","description":"[WCA Project] All of the code that runs on worldcubeassociation.org","fork":true,"url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org","forks_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/forks","keys_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/teams","hooks_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/hooks","issue_events_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/issues/events{/number}","events_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/events","assignees_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/assignees{/user}","branches_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/branches{/branch}","tags_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/tags","blobs_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/statuses/{sha}","languages_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/languages","stargazers_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/stargazers","contributors_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/contributors","subscribers_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/subscribers","subscription_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/subscription","commits_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/contents/{+path}","compare_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/merges","archive_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/downloads","issues_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/issues{/number}","pulls_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/pulls{/number}","milestones_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/milestones{/number}","notifications_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/labels{/name}","releases_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/releases{/id}","deployments_url":"https://api.github.com/repos/jonatanklosko/worldcubeassociation.org/deployments","created_at":"2016-03-27T20:29:06Z","updated_at":"2016-06-24T20:22:48Z","pushed_at":"2016-08-07T20:12:57Z","git_url":"git://github.com/jonatanklosko/worldcubeassociation.org.git","ssh_url":"git@github.com:jonatanklosko/worldcubeassociation.org.git","clone_url":"https://github.com/jonatanklosko/worldcubeassociation.org.git","svn_url":"https://github.com/jonatanklosko/worldcubeassociation.org","homepage":"https://www.worldcubeassociation.org/","size":52439,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cubing:master","ref":"master","sha":"33bad7768ac7ce4982e0fb60a66c4973372f24fb","user":{"login":"cubing","id":1092267,"avatar_url":"https://avatars.githubusercontent.com/u/1092267?v=3","gravatar_id":"","url":"https://api.github.com/users/cubing","html_url":"https://github.com/cubing","followers_url":"https://api.github.com/users/cubing/followers","following_url":"https://api.github.com/users/cubing/following{/other_user}","gists_url":"https://api.github.com/users/cubing/gists{/gist_id}","starred_url":"https://api.github.com/users/cubing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cubing/subscriptions","organizations_url":"https://api.github.com/users/cubing/orgs","repos_url":"https://api.github.com/users/cubing/repos","events_url":"https://api.github.com/users/cubing/events{/privacy}","received_events_url":"https://api.github.com/users/cubing/received_events","type":"Organization","site_admin":false},"repo":{"id":34161579,"name":"worldcubeassociation.org","full_name":"cubing/worldcubeassociation.org","owner":{"login":"cubing","id":1092267,"avatar_url":"https://avatars.githubusercontent.com/u/1092267?v=3","gravatar_id":"","url":"https://api.github.com/users/cubing","html_url":"https://github.com/cubing","followers_url":"https://api.github.com/users/cubing/followers","following_url":"https://api.github.com/users/cubing/following{/other_user}","gists_url":"https://api.github.com/users/cubing/gists{/gist_id}","starred_url":"https://api.github.com/users/cubing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cubing/subscriptions","organizations_url":"https://api.github.com/users/cubing/orgs","repos_url":"https://api.github.com/users/cubing/repos","events_url":"https://api.github.com/users/cubing/events{/privacy}","received_events_url":"https://api.github.com/users/cubing/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cubing/worldcubeassociation.org","description":"[WCA Project] All of the code that runs on worldcubeassociation.org","fork":false,"url":"https://api.github.com/repos/cubing/worldcubeassociation.org","forks_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/forks","keys_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/teams","hooks_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/hooks","issue_events_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/events{/number}","events_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/events","assignees_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/assignees{/user}","branches_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/branches{/branch}","tags_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/tags","blobs_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/{sha}","languages_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/languages","stargazers_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/stargazers","contributors_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/contributors","subscribers_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/subscribers","subscription_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/subscription","commits_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/comments{/number}","contents_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/contents/{+path}","compare_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/merges","archive_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/downloads","issues_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues{/number}","pulls_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls{/number}","milestones_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/milestones{/number}","notifications_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/labels{/name}","releases_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/releases{/id}","deployments_url":"https://api.github.com/repos/cubing/worldcubeassociation.org/deployments","created_at":"2015-04-18T10:21:53Z","updated_at":"2016-07-31T18:31:59Z","pushed_at":"2016-08-07T22:25:11Z","git_url":"git://github.com/cubing/worldcubeassociation.org.git","ssh_url":"git@github.com:cubing/worldcubeassociation.org.git","clone_url":"https://github.com/cubing/worldcubeassociation.org.git","svn_url":"https://github.com/cubing/worldcubeassociation.org","homepage":"https://www.worldcubeassociation.org/","size":56019,"stargazers_count":22,"watchers_count":22,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":173,"forks":29,"open_issues":173,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/804"},"html":{"href":"https://github.com/cubing/worldcubeassociation.org/pull/804"},"issue":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/804"},"comments":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/issues/804/comments"},"review_comments":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/804/comments"},"review_comment":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/pulls/804/commits"},"statuses":{"href":"https://api.github.com/repos/cubing/worldcubeassociation.org/statuses/8acb7f702c763814bd771b2a416f89585d7c6ef1"}}}}
{"actor":{"display_login":"larspetrus"}}