{"action":"closed","number":51,"pull_request":{"url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/pulls/51","id":41564451,"html_url":"https://github.com/alphagov/digitalmarketplace-search-api/pull/51","diff_url":"https://github.com/alphagov/digitalmarketplace-search-api/pull/51.diff","patch_url":"https://github.com/alphagov/digitalmarketplace-search-api/pull/51.patch","issue_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/issues/51","number":51,"state":"closed","locked":false,"title":"[#99425224] Add rough word limit on es highlight excerpts","user":{"login":"pcraig3","id":2454380,"avatar_url":"https://avatars.githubusercontent.com/u/2454380?v=3","gravatar_id":"","url":"https://api.github.com/users/pcraig3","html_url":"https://github.com/pcraig3","followers_url":"https://api.github.com/users/pcraig3/followers","following_url":"https://api.github.com/users/pcraig3/following{/other_user}","gists_url":"https://api.github.com/users/pcraig3/gists{/gist_id}","starred_url":"https://api.github.com/users/pcraig3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcraig3/subscriptions","organizations_url":"https://api.github.com/users/pcraig3/orgs","repos_url":"https://api.github.com/users/pcraig3/repos","events_url":"https://api.github.com/users/pcraig3/events{/privacy}","received_events_url":"https://api.github.com/users/pcraig3/received_events","type":"User","site_admin":false},"body":"**This fixes a problem whereby the entire service summary for G5 services (some of which have really long summaries) would be returned in the search results if no search terms were specified.**\r\n\r\n***\r\n\r\nHighlight excerpts for all service fields returned from elasticsearch now 400 character limit. This is enforced whether or not a search term has been found.\r\nIf no search term is found, up to the first 400 characters of the field will be used as the basis for the `highlight` snippet.\r\n\r\nelasticsearch tries not to break in the middle of a word.  From the documentation: \r\n> The actual length may be shorter than specified as it tries to break on a word boundary.\r\n\r\nTrailing punctuation is also removed.\r\nRoughly approximates our 50-word limit on service summaries for G6+ services.\r\n\r\nMore information about highlighted fragments can be found [here](https://www.elastic.co/guide/en/elasticsearch/reference/1.6/search-request-highlighting.html#_highlighted_fragments).\r\n\r\n[>> Story on Pivotal](https://www.pivotaltracker.com/story/show/99425224)\r\n\r\n***\r\n\r\n#### G5 Service with really long description before character limit\r\n![screen shot 2015-08-04 at 15 24 42](https://cloud.githubusercontent.com/assets/2454380/9063222/5b75f856-3abe-11e5-8372-25aa611a57ae.png)\r\n\r\n\r\n#### G5 Service with really long description after character limit\r\n![screen shot 2015-08-04 at 15 25 11](https://cloud.githubusercontent.com/assets/2454380/9063225/5fca281e-3abe-11e5-8264-aad66a8da9fe.png)\r\n\r\n*** \r\n\r\n#### Notes: \r\nDiscovered what appears to be a bug.\r\nThe character limit for a highlight excerpt (when a match has been found) is only respected if the character limit is less than ~2/3 of the original data.\r\nFor example, if a matched word is found in a 600-character service summary and our `fragment_size` limit is set to `400`, the entire summary will be returned as a highlight fragment.\r\nA 610-character service summary would be truncated as expected.\r\nUsing the fast vector highlighter seems to fix the problem, but since it's not really an issue for us, I've not changed the default highlighter.","created_at":"2015-08-04T12:33:46Z","updated_at":"2015-08-05T10:06:56Z","closed_at":"2015-08-05T10:06:56Z","merged_at":"2015-08-05T10:06:56Z","merge_commit_sha":"e5c62f8574d51943495a6e69c83af54cdabbec34","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/pulls/51/commits","review_comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/pulls/51/comments","review_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/issues/51/comments","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/statuses/1d9c06f00e022ce97f6ede3d7f0dac44c66ca58e","head":{"label":"alphagov:pc_shorten_search_summary_snippet","ref":"pc_shorten_search_summary_snippet","sha":"1d9c06f00e022ce97f6ede3d7f0dac44c66ca58e","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":30530410,"name":"digitalmarketplace-search-api","full_name":"alphagov/digitalmarketplace-search-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/digitalmarketplace-search-api","description":"API to handle interactions between the digitalmarketplace applications and search applications.","fork":false,"url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api","forks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/forks","keys_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/teams","hooks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/events","assignees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/tags","blobs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/subscription","commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/merges","archive_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/downloads","issues_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/releases{/id}","created_at":"2015-02-09T10:24:46Z","updated_at":"2015-05-08T13:18:49Z","pushed_at":"2015-08-05T10:06:56Z","git_url":"git://github.com/alphagov/digitalmarketplace-search-api.git","ssh_url":"git@github.com:alphagov/digitalmarketplace-search-api.git","clone_url":"https://github.com/alphagov/digitalmarketplace-search-api.git","svn_url":"https://github.com/alphagov/digitalmarketplace-search-api","homepage":null,"size":5093,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"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":1,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"3fbcb5feb9b2d768e3e0e2b841f2cd0c278533da","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":30530410,"name":"digitalmarketplace-search-api","full_name":"alphagov/digitalmarketplace-search-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/digitalmarketplace-search-api","description":"API to handle interactions between the digitalmarketplace applications and search applications.","fork":false,"url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api","forks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/forks","keys_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/teams","hooks_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/events","assignees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/tags","blobs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/subscription","commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/merges","archive_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/downloads","issues_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/releases{/id}","created_at":"2015-02-09T10:24:46Z","updated_at":"2015-05-08T13:18:49Z","pushed_at":"2015-08-05T10:06:56Z","git_url":"git://github.com/alphagov/digitalmarketplace-search-api.git","ssh_url":"git@github.com:alphagov/digitalmarketplace-search-api.git","clone_url":"https://github.com/alphagov/digitalmarketplace-search-api.git","svn_url":"https://github.com/alphagov/digitalmarketplace-search-api","homepage":null,"size":5093,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"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":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/pulls/51"},"html":{"href":"https://github.com/alphagov/digitalmarketplace-search-api/pull/51"},"issue":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/issues/51"},"comments":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/issues/51/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/pulls/51/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/pulls/51/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/digitalmarketplace-search-api/statuses/1d9c06f00e022ce97f6ede3d7f0dac44c66ca58e"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"pcraig3","id":2454380,"avatar_url":"https://avatars.githubusercontent.com/u/2454380?v=3","gravatar_id":"","url":"https://api.github.com/users/pcraig3","html_url":"https://github.com/pcraig3","followers_url":"https://api.github.com/users/pcraig3/followers","following_url":"https://api.github.com/users/pcraig3/following{/other_user}","gists_url":"https://api.github.com/users/pcraig3/gists{/gist_id}","starred_url":"https://api.github.com/users/pcraig3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pcraig3/subscriptions","organizations_url":"https://api.github.com/users/pcraig3/orgs","repos_url":"https://api.github.com/users/pcraig3/repos","events_url":"https://api.github.com/users/pcraig3/events{/privacy}","received_events_url":"https://api.github.com/users/pcraig3/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":1,"additions":94,"deletions":33,"changed_files":3}}