{"action":"created","comment":{"url":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/comments/38568850","id":38568850,"diff_hunk":"@@ -342,11 +342,16 @@ def search(self, query_string, sort_by=None, start_offset=0, end_offset=None,\n \n         if highlight is True:\n             kwargs['hl'] = 'true'\n-            kwargs['hl.fragsize'] = '100'\n-            kwargs['hl.snippets'] = '2'\n+            kwargs['hl.fl'] = 'description'\n+            kwargs['hl.alternateField'] = 'description'\n+            kwargs['hl.maxAlternateFieldLength'] = \\\n+                settings.SEARCH_FRAGMENT_SIZE\n+            kwargs['hl.requireFieldMatch'] = 'true'\n+            kwargs['hl.fragsize'] = settings.SEARCH_FRAGMENT_SIZE\n+            kwargs['hl.snippets'] = settings.SEARCH_SNIPPETS\n             kwargs['hl.mergeContiguous'] = 'true'\n-            kwargs['hl.simple.pre'] = '<b>'\n-            kwargs['hl.simple.post'] = '</b>'\n+            kwargs['hl.simple.pre'] = '###{{{###'","path":"seo/search_backend.py","position":16,"original_position":16,"commit_id":"690994f729f022ee9ebdf3c32df25df9318b1574","original_commit_id":"690994f729f022ee9ebdf3c32df25df9318b1574","user":{"login":"aspidites","id":93686,"avatar_url":"https://avatars.githubusercontent.com/u/93686?v=3","gravatar_id":"","url":"https://api.github.com/users/aspidites","html_url":"https://github.com/aspidites","followers_url":"https://api.github.com/users/aspidites/followers","following_url":"https://api.github.com/users/aspidites/following{/other_user}","gists_url":"https://api.github.com/users/aspidites/gists{/gist_id}","starred_url":"https://api.github.com/users/aspidites/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspidites/subscriptions","organizations_url":"https://api.github.com/users/aspidites/orgs","repos_url":"https://api.github.com/users/aspidites/repos","events_url":"https://api.github.com/users/aspidites/events{/privacy}","received_events_url":"https://api.github.com/users/aspidites/received_events","type":"User","site_admin":false},"body":"Ah. I still think built-in string formatting would be safer/cleaner than the arbitrary escape sequence:\r\n\r\n```python\r\nkwargs['hl.simple.pre = \"{hl_pre}\"\r\nkwargs['hl.simple.post'] = \"{hl_post}\"\r\n...\r\nhighlited.format(hl_pre=\"<b>\", hl_post=\"</b>\")\r\n```\r\n\r\nIf there are more substitutions, you could probably just save them all then pass that to format:\r\n```python\r\nsubstitutions = {\r\n    \"hl_pre\": \"<b>\",\r\n    \"hl_post\": \"</b>\"\r\n}\r\n...\r\nhighlighted.format(**substitutions)\r\n```\r\n```","created_at":"2015-09-02T18:44:12Z","updated_at":"2015-09-02T18:44:12Z","html_url":"https://github.com/DirectEmployers/MyJobs/pull/1731#discussion_r38568850","pull_request_url":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/1731","_links":{"self":{"href":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/comments/38568850"},"html":{"href":"https://github.com/DirectEmployers/MyJobs/pull/1731#discussion_r38568850"},"pull_request":{"href":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/1731"}}},"pull_request":{"url":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/1731","id":43918426,"html_url":"https://github.com/DirectEmployers/MyJobs/pull/1731","diff_url":"https://github.com/DirectEmployers/MyJobs/pull/1731.diff","patch_url":"https://github.com/DirectEmployers/MyJobs/pull/1731.patch","issue_url":"https://api.github.com/repos/DirectEmployers/MyJobs/issues/1731","number":1731,"state":"open","locked":false,"title":"Use solr highlighting for search results. [PD-1438]","user":{"login":"darrint","id":108186,"avatar_url":"https://avatars.githubusercontent.com/u/108186?v=3","gravatar_id":"","url":"https://api.github.com/users/darrint","html_url":"https://github.com/darrint","followers_url":"https://api.github.com/users/darrint/followers","following_url":"https://api.github.com/users/darrint/following{/other_user}","gists_url":"https://api.github.com/users/darrint/gists{/gist_id}","starred_url":"https://api.github.com/users/darrint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darrint/subscriptions","organizations_url":"https://api.github.com/users/darrint/orgs","repos_url":"https://api.github.com/users/darrint/repos","events_url":"https://api.github.com/users/darrint/events{/privacy}","received_events_url":"https://api.github.com/users/darrint/received_events","type":"User","site_admin":false},"body":"This uses solr's native highlighting where possible to highlight search results.\r\n\r\nRemove description from the solr query to improve Solr network use.\r\n\r\n**Note 1:** some search behavior is changed.\r\n\r\n**Note 2:** ~~Some tests are failing because they are expecting solr to avoid exact string matches entirely and only follow stems.~~ To get exact highlight matches I had to admit exact string matches.","created_at":"2015-09-01T19:49:40Z","updated_at":"2015-09-02T18:44:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d8f72be29bd8f5f27bc92bf1b50359ca475e0de3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/1731/commits","review_comments_url":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/1731/comments","review_comment_url":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DirectEmployers/MyJobs/issues/1731/comments","statuses_url":"https://api.github.com/repos/DirectEmployers/MyJobs/statuses/690994f729f022ee9ebdf3c32df25df9318b1574","head":{"label":"DirectEmployers:use-solr-highlighting--pd-1438","ref":"use-solr-highlighting--pd-1438","sha":"690994f729f022ee9ebdf3c32df25df9318b1574","user":{"login":"DirectEmployers","id":381171,"avatar_url":"https://avatars.githubusercontent.com/u/381171?v=3","gravatar_id":"","url":"https://api.github.com/users/DirectEmployers","html_url":"https://github.com/DirectEmployers","followers_url":"https://api.github.com/users/DirectEmployers/followers","following_url":"https://api.github.com/users/DirectEmployers/following{/other_user}","gists_url":"https://api.github.com/users/DirectEmployers/gists{/gist_id}","starred_url":"https://api.github.com/users/DirectEmployers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DirectEmployers/subscriptions","organizations_url":"https://api.github.com/users/DirectEmployers/orgs","repos_url":"https://api.github.com/users/DirectEmployers/repos","events_url":"https://api.github.com/users/DirectEmployers/events{/privacy}","received_events_url":"https://api.github.com/users/DirectEmployers/received_events","type":"Organization","site_admin":false},"repo":{"id":2867982,"name":"MyJobs","full_name":"DirectEmployers/MyJobs","owner":{"login":"DirectEmployers","id":381171,"avatar_url":"https://avatars.githubusercontent.com/u/381171?v=3","gravatar_id":"","url":"https://api.github.com/users/DirectEmployers","html_url":"https://github.com/DirectEmployers","followers_url":"https://api.github.com/users/DirectEmployers/followers","following_url":"https://api.github.com/users/DirectEmployers/following{/other_user}","gists_url":"https://api.github.com/users/DirectEmployers/gists{/gist_id}","starred_url":"https://api.github.com/users/DirectEmployers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DirectEmployers/subscriptions","organizations_url":"https://api.github.com/users/DirectEmployers/orgs","repos_url":"https://api.github.com/users/DirectEmployers/repos","events_url":"https://api.github.com/users/DirectEmployers/events{/privacy}","received_events_url":"https://api.github.com/users/DirectEmployers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DirectEmployers/MyJobs","description":"Multi-user website designed to assist job seekers in their search for employment","fork":false,"url":"https://api.github.com/repos/DirectEmployers/MyJobs","forks_url":"https://api.github.com/repos/DirectEmployers/MyJobs/forks","keys_url":"https://api.github.com/repos/DirectEmployers/MyJobs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DirectEmployers/MyJobs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DirectEmployers/MyJobs/teams","hooks_url":"https://api.github.com/repos/DirectEmployers/MyJobs/hooks","issue_events_url":"https://api.github.com/repos/DirectEmployers/MyJobs/issues/events{/number}","events_url":"https://api.github.com/repos/DirectEmployers/MyJobs/events","assignees_url":"https://api.github.com/repos/DirectEmployers/MyJobs/assignees{/user}","branches_url":"https://api.github.com/repos/DirectEmployers/MyJobs/branches{/branch}","tags_url":"https://api.github.com/repos/DirectEmployers/MyJobs/tags","blobs_url":"https://api.github.com/repos/DirectEmployers/MyJobs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DirectEmployers/MyJobs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DirectEmployers/MyJobs/git/refs{/sha}","trees_url":"https://api.github.com/repos/DirectEmployers/MyJobs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DirectEmployers/MyJobs/statuses/{sha}","languages_url":"https://api.github.com/repos/DirectEmployers/MyJobs/languages","stargazers_url":"https://api.github.com/repos/DirectEmployers/MyJobs/stargazers","contributors_url":"https://api.github.com/repos/DirectEmployers/MyJobs/contributors","subscribers_url":"https://api.github.com/repos/DirectEmployers/MyJobs/subscribers","subscription_url":"https://api.github.com/repos/DirectEmployers/MyJobs/subscription","commits_url":"https://api.github.com/repos/DirectEmployers/MyJobs/commits{/sha}","git_commits_url":"https://api.github.com/repos/DirectEmployers/MyJobs/git/commits{/sha}","comments_url":"https://api.github.com/repos/DirectEmployers/MyJobs/comments{/number}","issue_comment_url":"https://api.github.com/repos/DirectEmployers/MyJobs/issues/comments{/number}","contents_url":"https://api.github.com/repos/DirectEmployers/MyJobs/contents/{+path}","compare_url":"https://api.github.com/repos/DirectEmployers/MyJobs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DirectEmployers/MyJobs/merges","archive_url":"https://api.github.com/repos/DirectEmployers/MyJobs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DirectEmployers/MyJobs/downloads","issues_url":"https://api.github.com/repos/DirectEmployers/MyJobs/issues{/number}","pulls_url":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls{/number}","milestones_url":"https://api.github.com/repos/DirectEmployers/MyJobs/milestones{/number}","notifications_url":"https://api.github.com/repos/DirectEmployers/MyJobs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DirectEmployers/MyJobs/labels{/name}","releases_url":"https://api.github.com/repos/DirectEmployers/MyJobs/releases{/id}","created_at":"2011-11-28T15:22:36Z","updated_at":"2015-06-22T16:37:22Z","pushed_at":"2015-09-02T18:36:00Z","git_url":"git://github.com/DirectEmployers/MyJobs.git","ssh_url":"git@github.com:DirectEmployers/MyJobs.git","clone_url":"https://github.com/DirectEmployers/MyJobs.git","svn_url":"https://github.com/DirectEmployers/MyJobs","homepage":"http://my.jobs","size":34121,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":4,"forks":8,"open_issues":4,"watchers":5,"default_branch":"quality-control"}},"base":{"label":"DirectEmployers:quality-control","ref":"quality-control","sha":"82ee8417d606372e4dfd1d4acf72071901470cba","user":{"login":"DirectEmployers","id":381171,"avatar_url":"https://avatars.githubusercontent.com/u/381171?v=3","gravatar_id":"","url":"https://api.github.com/users/DirectEmployers","html_url":"https://github.com/DirectEmployers","followers_url":"https://api.github.com/users/DirectEmployers/followers","following_url":"https://api.github.com/users/DirectEmployers/following{/other_user}","gists_url":"https://api.github.com/users/DirectEmployers/gists{/gist_id}","starred_url":"https://api.github.com/users/DirectEmployers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DirectEmployers/subscriptions","organizations_url":"https://api.github.com/users/DirectEmployers/orgs","repos_url":"https://api.github.com/users/DirectEmployers/repos","events_url":"https://api.github.com/users/DirectEmployers/events{/privacy}","received_events_url":"https://api.github.com/users/DirectEmployers/received_events","type":"Organization","site_admin":false},"repo":{"id":2867982,"name":"MyJobs","full_name":"DirectEmployers/MyJobs","owner":{"login":"DirectEmployers","id":381171,"avatar_url":"https://avatars.githubusercontent.com/u/381171?v=3","gravatar_id":"","url":"https://api.github.com/users/DirectEmployers","html_url":"https://github.com/DirectEmployers","followers_url":"https://api.github.com/users/DirectEmployers/followers","following_url":"https://api.github.com/users/DirectEmployers/following{/other_user}","gists_url":"https://api.github.com/users/DirectEmployers/gists{/gist_id}","starred_url":"https://api.github.com/users/DirectEmployers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DirectEmployers/subscriptions","organizations_url":"https://api.github.com/users/DirectEmployers/orgs","repos_url":"https://api.github.com/users/DirectEmployers/repos","events_url":"https://api.github.com/users/DirectEmployers/events{/privacy}","received_events_url":"https://api.github.com/users/DirectEmployers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DirectEmployers/MyJobs","description":"Multi-user website designed to assist job seekers in their search for employment","fork":false,"url":"https://api.github.com/repos/DirectEmployers/MyJobs","forks_url":"https://api.github.com/repos/DirectEmployers/MyJobs/forks","keys_url":"https://api.github.com/repos/DirectEmployers/MyJobs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DirectEmployers/MyJobs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DirectEmployers/MyJobs/teams","hooks_url":"https://api.github.com/repos/DirectEmployers/MyJobs/hooks","issue_events_url":"https://api.github.com/repos/DirectEmployers/MyJobs/issues/events{/number}","events_url":"https://api.github.com/repos/DirectEmployers/MyJobs/events","assignees_url":"https://api.github.com/repos/DirectEmployers/MyJobs/assignees{/user}","branches_url":"https://api.github.com/repos/DirectEmployers/MyJobs/branches{/branch}","tags_url":"https://api.github.com/repos/DirectEmployers/MyJobs/tags","blobs_url":"https://api.github.com/repos/DirectEmployers/MyJobs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DirectEmployers/MyJobs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DirectEmployers/MyJobs/git/refs{/sha}","trees_url":"https://api.github.com/repos/DirectEmployers/MyJobs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DirectEmployers/MyJobs/statuses/{sha}","languages_url":"https://api.github.com/repos/DirectEmployers/MyJobs/languages","stargazers_url":"https://api.github.com/repos/DirectEmployers/MyJobs/stargazers","contributors_url":"https://api.github.com/repos/DirectEmployers/MyJobs/contributors","subscribers_url":"https://api.github.com/repos/DirectEmployers/MyJobs/subscribers","subscription_url":"https://api.github.com/repos/DirectEmployers/MyJobs/subscription","commits_url":"https://api.github.com/repos/DirectEmployers/MyJobs/commits{/sha}","git_commits_url":"https://api.github.com/repos/DirectEmployers/MyJobs/git/commits{/sha}","comments_url":"https://api.github.com/repos/DirectEmployers/MyJobs/comments{/number}","issue_comment_url":"https://api.github.com/repos/DirectEmployers/MyJobs/issues/comments{/number}","contents_url":"https://api.github.com/repos/DirectEmployers/MyJobs/contents/{+path}","compare_url":"https://api.github.com/repos/DirectEmployers/MyJobs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DirectEmployers/MyJobs/merges","archive_url":"https://api.github.com/repos/DirectEmployers/MyJobs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DirectEmployers/MyJobs/downloads","issues_url":"https://api.github.com/repos/DirectEmployers/MyJobs/issues{/number}","pulls_url":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls{/number}","milestones_url":"https://api.github.com/repos/DirectEmployers/MyJobs/milestones{/number}","notifications_url":"https://api.github.com/repos/DirectEmployers/MyJobs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DirectEmployers/MyJobs/labels{/name}","releases_url":"https://api.github.com/repos/DirectEmployers/MyJobs/releases{/id}","created_at":"2011-11-28T15:22:36Z","updated_at":"2015-06-22T16:37:22Z","pushed_at":"2015-09-02T18:36:00Z","git_url":"git://github.com/DirectEmployers/MyJobs.git","ssh_url":"git@github.com:DirectEmployers/MyJobs.git","clone_url":"https://github.com/DirectEmployers/MyJobs.git","svn_url":"https://github.com/DirectEmployers/MyJobs","homepage":"http://my.jobs","size":34121,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":4,"forks":8,"open_issues":4,"watchers":5,"default_branch":"quality-control"}},"_links":{"self":{"href":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/1731"},"html":{"href":"https://github.com/DirectEmployers/MyJobs/pull/1731"},"issue":{"href":"https://api.github.com/repos/DirectEmployers/MyJobs/issues/1731"},"comments":{"href":"https://api.github.com/repos/DirectEmployers/MyJobs/issues/1731/comments"},"review_comments":{"href":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/1731/comments"},"review_comment":{"href":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DirectEmployers/MyJobs/pulls/1731/commits"},"statuses":{"href":"https://api.github.com/repos/DirectEmployers/MyJobs/statuses/690994f729f022ee9ebdf3c32df25df9318b1574"}}}}