{"action":"created","comment":{"url":"https://api.github.com/repos/coveo/search-ui/pulls/comments/218815756","pull_request_review_id":156836402,"id":218815756,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODgxNTc1Ng==","diff_hunk":"@@ -77,13 +77,21 @@ export class StreamHighlightUtils {\n \n export function getRestHighlightsForAllTerms(\n   toHighlight: string,\n-  termsToHighlight: { [originalTerm: string]: string[] },\n-  phrasesToHighlight: { [phrase: string]: { [originalTerm: string]: string[] } },\n+  termsToHighlight: IHighlightTerm,\n+  phrasesToHighlight: IHighlightPhrase,\n   opts: IStreamHighlightOptions\n ): IHighlight[] {\n   const indexes = [];\n   const sortedTerms = _.keys(termsToHighlight).sort(termsSorting);\n-  _.each(sortedTerms, (term: string) => {\n+\n+  const phrasesTerms = _.chain(phrasesToHighlight)\n+    .values()\n+    .map(_.keys)\n+    .flatten()\n+    .value();\n+  const uniqueTerms = _.difference(sortedTerms, phrasesTerms);","path":"src/utils/StreamHighlightUtils.ts","position":50,"original_position":50,"commit_id":"4bb05387ceb85dff175794311dd6798481c670df","original_commit_id":"4bb05387ceb85dff175794311dd6798481c670df","user":{"login":"samisayegh","id":5565841,"node_id":"MDQ6VXNlcjU1NjU4NDE=","avatar_url":"https://avatars2.githubusercontent.com/u/5565841?v=4","gravatar_id":"","url":"https://api.github.com/users/samisayegh","html_url":"https://github.com/samisayegh","followers_url":"https://api.github.com/users/samisayegh/followers","following_url":"https://api.github.com/users/samisayegh/following{/other_user}","gists_url":"https://api.github.com/users/samisayegh/gists{/gist_id}","starred_url":"https://api.github.com/users/samisayegh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samisayegh/subscriptions","organizations_url":"https://api.github.com/users/samisayegh/orgs","repos_url":"https://api.github.com/users/samisayegh/repos","events_url":"https://api.github.com/users/samisayegh/events{/privacy}","received_events_url":"https://api.github.com/users/samisayegh/received_events","type":"User","site_admin":false},"body":"What is the difference between `sortedTerms` and `phrasesTerms`? I ask because here you made the decision to exclude duplicates from being rendered as `sortedTerms`. Is there a reason why we would maybe exclude it from the `phrasesTerms` instead? Or does it not matter?","created_at":"2018-09-19T14:02:18Z","updated_at":"2018-09-19T14:29:12Z","html_url":"https://github.com/coveo/search-ui/pull/920#discussion_r218815756","pull_request_url":"https://api.github.com/repos/coveo/search-ui/pulls/920","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/comments/218815756"},"html":{"href":"https://github.com/coveo/search-ui/pull/920#discussion_r218815756"},"pull_request":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/920"}}},"pull_request":{"url":"https://api.github.com/repos/coveo/search-ui/pulls/920","id":216435326,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE2NDM1MzI2","html_url":"https://github.com/coveo/search-ui/pull/920","diff_url":"https://github.com/coveo/search-ui/pull/920.diff","patch_url":"https://github.com/coveo/search-ui/pull/920.patch","issue_url":"https://api.github.com/repos/coveo/search-ui/issues/920","number":920,"state":"open","locked":false,"title":"JSUI-2241 Prevent a term from being highlighted two times","user":{"login":"ThibodeauJF","id":4923043,"node_id":"MDQ6VXNlcjQ5MjMwNDM=","avatar_url":"https://avatars0.githubusercontent.com/u/4923043?v=4","gravatar_id":"","url":"https://api.github.com/users/ThibodeauJF","html_url":"https://github.com/ThibodeauJF","followers_url":"https://api.github.com/users/ThibodeauJF/followers","following_url":"https://api.github.com/users/ThibodeauJF/following{/other_user}","gists_url":"https://api.github.com/users/ThibodeauJF/gists{/gist_id}","starred_url":"https://api.github.com/users/ThibodeauJF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThibodeauJF/subscriptions","organizations_url":"https://api.github.com/users/ThibodeauJF/orgs","repos_url":"https://api.github.com/users/ThibodeauJF/repos","events_url":"https://api.github.com/users/ThibodeauJF/events{/privacy}","received_events_url":"https://api.github.com/users/ThibodeauJF/received_events","type":"User","site_admin":false},"body":"When a term was present at the end of a phrase (phrasesToHighlight) and was also a term (termsToHighlight), it was displayed twice\r\n\r\nhttps://coveord.atlassian.net/browse/JSUI-2241\r\n\r\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/pipelines/a3535101-5bbf-4a5b-a909-47fcf8c9f149)","created_at":"2018-09-18T20:33:31Z","updated_at":"2018-09-19T14:29:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2582e0fd9a901601d027f34ef6cfb9bd7d3081c3","assignee":null,"assignees":[],"requested_reviewers":[{"login":"olamothe","id":1591893,"node_id":"MDQ6VXNlcjE1OTE4OTM=","avatar_url":"https://avatars1.githubusercontent.com/u/1591893?v=4","gravatar_id":"","url":"https://api.github.com/users/olamothe","html_url":"https://github.com/olamothe","followers_url":"https://api.github.com/users/olamothe/followers","following_url":"https://api.github.com/users/olamothe/following{/other_user}","gists_url":"https://api.github.com/users/olamothe/gists{/gist_id}","starred_url":"https://api.github.com/users/olamothe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olamothe/subscriptions","organizations_url":"https://api.github.com/users/olamothe/orgs","repos_url":"https://api.github.com/users/olamothe/repos","events_url":"https://api.github.com/users/olamothe/events{/privacy}","received_events_url":"https://api.github.com/users/olamothe/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/coveo/search-ui/pulls/920/commits","review_comments_url":"https://api.github.com/repos/coveo/search-ui/pulls/920/comments","review_comment_url":"https://api.github.com/repos/coveo/search-ui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/coveo/search-ui/issues/920/comments","statuses_url":"https://api.github.com/repos/coveo/search-ui/statuses/4bb05387ceb85dff175794311dd6798481c670df","head":{"label":"coveo:JSUI-2241","ref":"JSUI-2241","sha":"4bb05387ceb85dff175794311dd6798481c670df","user":{"login":"coveo","id":8632328,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MzIzMjg=","avatar_url":"https://avatars2.githubusercontent.com/u/8632328?v=4","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"repo":{"id":58133471,"node_id":"MDEwOlJlcG9zaXRvcnk1ODEzMzQ3MQ==","name":"search-ui","full_name":"coveo/search-ui","private":false,"owner":{"login":"coveo","id":8632328,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MzIzMjg=","avatar_url":"https://avatars2.githubusercontent.com/u/8632328?v=4","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/coveo/search-ui","description":"Coveo Search UI framework","fork":false,"url":"https://api.github.com/repos/coveo/search-ui","forks_url":"https://api.github.com/repos/coveo/search-ui/forks","keys_url":"https://api.github.com/repos/coveo/search-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coveo/search-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coveo/search-ui/teams","hooks_url":"https://api.github.com/repos/coveo/search-ui/hooks","issue_events_url":"https://api.github.com/repos/coveo/search-ui/issues/events{/number}","events_url":"https://api.github.com/repos/coveo/search-ui/events","assignees_url":"https://api.github.com/repos/coveo/search-ui/assignees{/user}","branches_url":"https://api.github.com/repos/coveo/search-ui/branches{/branch}","tags_url":"https://api.github.com/repos/coveo/search-ui/tags","blobs_url":"https://api.github.com/repos/coveo/search-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coveo/search-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coveo/search-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/coveo/search-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coveo/search-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/coveo/search-ui/languages","stargazers_url":"https://api.github.com/repos/coveo/search-ui/stargazers","contributors_url":"https://api.github.com/repos/coveo/search-ui/contributors","subscribers_url":"https://api.github.com/repos/coveo/search-ui/subscribers","subscription_url":"https://api.github.com/repos/coveo/search-ui/subscription","commits_url":"https://api.github.com/repos/coveo/search-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/coveo/search-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/coveo/search-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/coveo/search-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/coveo/search-ui/contents/{+path}","compare_url":"https://api.github.com/repos/coveo/search-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coveo/search-ui/merges","archive_url":"https://api.github.com/repos/coveo/search-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coveo/search-ui/downloads","issues_url":"https://api.github.com/repos/coveo/search-ui/issues{/number}","pulls_url":"https://api.github.com/repos/coveo/search-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/coveo/search-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/coveo/search-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coveo/search-ui/labels{/name}","releases_url":"https://api.github.com/repos/coveo/search-ui/releases{/id}","deployments_url":"https://api.github.com/repos/coveo/search-ui/deployments","created_at":"2016-05-05T13:41:09Z","updated_at":"2018-09-19T13:27:03Z","pushed_at":"2018-09-19T13:26:59Z","git_url":"git://github.com/coveo/search-ui.git","ssh_url":"git@github.com:coveo/search-ui.git","clone_url":"https://github.com/coveo/search-ui.git","svn_url":"https://github.com/coveo/search-ui","homepage":null,"size":146983,"stargazers_count":54,"watchers_count":54,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":46,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":46,"open_issues":8,"watchers":54,"default_branch":"master"}},"base":{"label":"coveo:master","ref":"master","sha":"c1869e035e6329af1f4a48c48d3165c4ade42f0b","user":{"login":"coveo","id":8632328,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MzIzMjg=","avatar_url":"https://avatars2.githubusercontent.com/u/8632328?v=4","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"repo":{"id":58133471,"node_id":"MDEwOlJlcG9zaXRvcnk1ODEzMzQ3MQ==","name":"search-ui","full_name":"coveo/search-ui","private":false,"owner":{"login":"coveo","id":8632328,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2MzIzMjg=","avatar_url":"https://avatars2.githubusercontent.com/u/8632328?v=4","gravatar_id":"","url":"https://api.github.com/users/coveo","html_url":"https://github.com/coveo","followers_url":"https://api.github.com/users/coveo/followers","following_url":"https://api.github.com/users/coveo/following{/other_user}","gists_url":"https://api.github.com/users/coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveo/subscriptions","organizations_url":"https://api.github.com/users/coveo/orgs","repos_url":"https://api.github.com/users/coveo/repos","events_url":"https://api.github.com/users/coveo/events{/privacy}","received_events_url":"https://api.github.com/users/coveo/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/coveo/search-ui","description":"Coveo Search UI framework","fork":false,"url":"https://api.github.com/repos/coveo/search-ui","forks_url":"https://api.github.com/repos/coveo/search-ui/forks","keys_url":"https://api.github.com/repos/coveo/search-ui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/coveo/search-ui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/coveo/search-ui/teams","hooks_url":"https://api.github.com/repos/coveo/search-ui/hooks","issue_events_url":"https://api.github.com/repos/coveo/search-ui/issues/events{/number}","events_url":"https://api.github.com/repos/coveo/search-ui/events","assignees_url":"https://api.github.com/repos/coveo/search-ui/assignees{/user}","branches_url":"https://api.github.com/repos/coveo/search-ui/branches{/branch}","tags_url":"https://api.github.com/repos/coveo/search-ui/tags","blobs_url":"https://api.github.com/repos/coveo/search-ui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/coveo/search-ui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/coveo/search-ui/git/refs{/sha}","trees_url":"https://api.github.com/repos/coveo/search-ui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/coveo/search-ui/statuses/{sha}","languages_url":"https://api.github.com/repos/coveo/search-ui/languages","stargazers_url":"https://api.github.com/repos/coveo/search-ui/stargazers","contributors_url":"https://api.github.com/repos/coveo/search-ui/contributors","subscribers_url":"https://api.github.com/repos/coveo/search-ui/subscribers","subscription_url":"https://api.github.com/repos/coveo/search-ui/subscription","commits_url":"https://api.github.com/repos/coveo/search-ui/commits{/sha}","git_commits_url":"https://api.github.com/repos/coveo/search-ui/git/commits{/sha}","comments_url":"https://api.github.com/repos/coveo/search-ui/comments{/number}","issue_comment_url":"https://api.github.com/repos/coveo/search-ui/issues/comments{/number}","contents_url":"https://api.github.com/repos/coveo/search-ui/contents/{+path}","compare_url":"https://api.github.com/repos/coveo/search-ui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/coveo/search-ui/merges","archive_url":"https://api.github.com/repos/coveo/search-ui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/coveo/search-ui/downloads","issues_url":"https://api.github.com/repos/coveo/search-ui/issues{/number}","pulls_url":"https://api.github.com/repos/coveo/search-ui/pulls{/number}","milestones_url":"https://api.github.com/repos/coveo/search-ui/milestones{/number}","notifications_url":"https://api.github.com/repos/coveo/search-ui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/coveo/search-ui/labels{/name}","releases_url":"https://api.github.com/repos/coveo/search-ui/releases{/id}","deployments_url":"https://api.github.com/repos/coveo/search-ui/deployments","created_at":"2016-05-05T13:41:09Z","updated_at":"2018-09-19T13:27:03Z","pushed_at":"2018-09-19T13:26:59Z","git_url":"git://github.com/coveo/search-ui.git","ssh_url":"git@github.com:coveo/search-ui.git","clone_url":"https://github.com/coveo/search-ui.git","svn_url":"https://github.com/coveo/search-ui","homepage":null,"size":146983,"stargazers_count":54,"watchers_count":54,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":46,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":46,"open_issues":8,"watchers":54,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/920"},"html":{"href":"https://github.com/coveo/search-ui/pull/920"},"issue":{"href":"https://api.github.com/repos/coveo/search-ui/issues/920"},"comments":{"href":"https://api.github.com/repos/coveo/search-ui/issues/920/comments"},"review_comments":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/920/comments"},"review_comment":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/coveo/search-ui/pulls/920/commits"},"statuses":{"href":"https://api.github.com/repos/coveo/search-ui/statuses/4bb05387ceb85dff175794311dd6798481c670df"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"samisayegh"}}