{"action":"created","comment":{"url":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/comments/67924895","id":67924895,"diff_hunk":"@@ -0,0 +1,76 @@\n+package io.bittiger.ads.activity;\n+\n+import io.bittiger.ads.model.Ad;\n+import net.spy.memcached.MemcachedClient;\n+\n+import java.io.IOException;\n+import java.util.List;\n+import java.util.ArrayList;\n+import java.util.Set;\n+import java.util.HashSet;\n+import java.util.Arrays;\n+import java.lang.String;\n+\n+public class AdsSelection {\n+    private static AdsSelection instance = null;\n+    \n+    protected AdsSelection() {\n+    }\n+\n+    public static AdsSelection getInstance() {\n+        if (instance == null) {\n+            instance = new AdsSelection();\n+        }\n+        return instance;\n+    }\n+\n+    public List<Ad> getMatchedAds(String[] keywords) {\n+        List<Ad> ads = new ArrayList<Ad>();\n+        if (keywords == null || keywords.length == 0) {\n+            return new ArrayList<Ad>();\n+        }\n+\n+        Set<Ad> set = new HashSet<Ad>();\n+        for (String keyword : keywords) {\n+            String invKey = \"inv\" + keyword;\n+            Set<Ad> curr = (Set<Ad>) AdsDao.getInstance().getAds(invKey);\n+            if (curr == null) {\n+                curr = AdsDao.getInstance().traverseFwdIndex(keyword);\n+            }\n+            addAds(set, curr, keywords);\n+        }\n+\n+        for (Ad ad : set) {","path":"src/main/java/io/bittiger/ads/activity/AdsSelection.java","position":43,"original_position":43,"commit_id":"931a2c15f80089f7bfd2edfd6f1452288feeca55","original_commit_id":"931a2c15f80089f7bfd2edfd6f1452288feeca55","user":{"login":"lijljacklee","id":6657775,"avatar_url":"https://avatars.githubusercontent.com/u/6657775?v=3","gravatar_id":"","url":"https://api.github.com/users/lijljacklee","html_url":"https://github.com/lijljacklee","followers_url":"https://api.github.com/users/lijljacklee/followers","following_url":"https://api.github.com/users/lijljacklee/following{/other_user}","gists_url":"https://api.github.com/users/lijljacklee/gists{/gist_id}","starred_url":"https://api.github.com/users/lijljacklee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lijljacklee/subscriptions","organizations_url":"https://api.github.com/users/lijljacklee/orgs","repos_url":"https://api.github.com/users/lijljacklee/repos","events_url":"https://api.github.com/users/lijljacklee/events{/privacy}","received_events_url":"https://api.github.com/users/lijljacklee/received_events","type":"User","site_admin":false},"body":"I think you can use an override constructor here, \r\ni.e. List<Ad> ads = new ArrayList<Ad>(set);","created_at":"2016-06-21T18:28:05Z","updated_at":"2016-06-21T18:28:05Z","html_url":"https://github.com/lijljacklee/ads-searching-system/pull/7#discussion_r67924895","pull_request_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/comments/67924895"},"html":{"href":"https://github.com/lijljacklee/ads-searching-system/pull/7#discussion_r67924895"},"pull_request":{"href":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/7","id":73880247,"html_url":"https://github.com/lijljacklee/ads-searching-system/pull/7","diff_url":"https://github.com/lijljacklee/ads-searching-system/pull/7.diff","patch_url":"https://github.com/lijljacklee/ads-searching-system/pull/7.patch","issue_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/issues/7","number":7,"state":"open","locked":false,"title":"Select ads","user":{"login":"dojiangv","id":7834001,"avatar_url":"https://avatars.githubusercontent.com/u/7834001?v=3","gravatar_id":"","url":"https://api.github.com/users/dojiangv","html_url":"https://github.com/dojiangv","followers_url":"https://api.github.com/users/dojiangv/followers","following_url":"https://api.github.com/users/dojiangv/following{/other_user}","gists_url":"https://api.github.com/users/dojiangv/gists{/gist_id}","starred_url":"https://api.github.com/users/dojiangv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dojiangv/subscriptions","organizations_url":"https://api.github.com/users/dojiangv/orgs","repos_url":"https://api.github.com/users/dojiangv/repos","events_url":"https://api.github.com/users/dojiangv/events{/privacy}","received_events_url":"https://api.github.com/users/dojiangv/received_events","type":"User","site_admin":false},"body":"This PR create AdsSelect\r\n\r\n1) input String[] keywords;\r\n2) output List<Ad>\r\n3) The data structure of ads in memcached with same keyword need to be discussed in the next meeting.\r\n\r\n@lijljacklee @sleephu ","created_at":"2016-06-15T09:38:49Z","updated_at":"2016-06-21T18:28:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f21d22b53a99537135008bf908379ebb3220b8e4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/7/commits","review_comments_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/7/comments","review_comment_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/issues/7/comments","statuses_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/statuses/931a2c15f80089f7bfd2edfd6f1452288feeca55","head":{"label":"dojiangv:select-ads","ref":"select-ads","sha":"931a2c15f80089f7bfd2edfd6f1452288feeca55","user":{"login":"dojiangv","id":7834001,"avatar_url":"https://avatars.githubusercontent.com/u/7834001?v=3","gravatar_id":"","url":"https://api.github.com/users/dojiangv","html_url":"https://github.com/dojiangv","followers_url":"https://api.github.com/users/dojiangv/followers","following_url":"https://api.github.com/users/dojiangv/following{/other_user}","gists_url":"https://api.github.com/users/dojiangv/gists{/gist_id}","starred_url":"https://api.github.com/users/dojiangv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dojiangv/subscriptions","organizations_url":"https://api.github.com/users/dojiangv/orgs","repos_url":"https://api.github.com/users/dojiangv/repos","events_url":"https://api.github.com/users/dojiangv/events{/privacy}","received_events_url":"https://api.github.com/users/dojiangv/received_events","type":"User","site_admin":false},"repo":{"id":61192706,"name":"ads-searching-system","full_name":"dojiangv/ads-searching-system","owner":{"login":"dojiangv","id":7834001,"avatar_url":"https://avatars.githubusercontent.com/u/7834001?v=3","gravatar_id":"","url":"https://api.github.com/users/dojiangv","html_url":"https://github.com/dojiangv","followers_url":"https://api.github.com/users/dojiangv/followers","following_url":"https://api.github.com/users/dojiangv/following{/other_user}","gists_url":"https://api.github.com/users/dojiangv/gists{/gist_id}","starred_url":"https://api.github.com/users/dojiangv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dojiangv/subscriptions","organizations_url":"https://api.github.com/users/dojiangv/orgs","repos_url":"https://api.github.com/users/dojiangv/repos","events_url":"https://api.github.com/users/dojiangv/events{/privacy}","received_events_url":"https://api.github.com/users/dojiangv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dojiangv/ads-searching-system","description":"This is the project of 2nd team","fork":true,"url":"https://api.github.com/repos/dojiangv/ads-searching-system","forks_url":"https://api.github.com/repos/dojiangv/ads-searching-system/forks","keys_url":"https://api.github.com/repos/dojiangv/ads-searching-system/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dojiangv/ads-searching-system/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dojiangv/ads-searching-system/teams","hooks_url":"https://api.github.com/repos/dojiangv/ads-searching-system/hooks","issue_events_url":"https://api.github.com/repos/dojiangv/ads-searching-system/issues/events{/number}","events_url":"https://api.github.com/repos/dojiangv/ads-searching-system/events","assignees_url":"https://api.github.com/repos/dojiangv/ads-searching-system/assignees{/user}","branches_url":"https://api.github.com/repos/dojiangv/ads-searching-system/branches{/branch}","tags_url":"https://api.github.com/repos/dojiangv/ads-searching-system/tags","blobs_url":"https://api.github.com/repos/dojiangv/ads-searching-system/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dojiangv/ads-searching-system/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dojiangv/ads-searching-system/git/refs{/sha}","trees_url":"https://api.github.com/repos/dojiangv/ads-searching-system/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dojiangv/ads-searching-system/statuses/{sha}","languages_url":"https://api.github.com/repos/dojiangv/ads-searching-system/languages","stargazers_url":"https://api.github.com/repos/dojiangv/ads-searching-system/stargazers","contributors_url":"https://api.github.com/repos/dojiangv/ads-searching-system/contributors","subscribers_url":"https://api.github.com/repos/dojiangv/ads-searching-system/subscribers","subscription_url":"https://api.github.com/repos/dojiangv/ads-searching-system/subscription","commits_url":"https://api.github.com/repos/dojiangv/ads-searching-system/commits{/sha}","git_commits_url":"https://api.github.com/repos/dojiangv/ads-searching-system/git/commits{/sha}","comments_url":"https://api.github.com/repos/dojiangv/ads-searching-system/comments{/number}","issue_comment_url":"https://api.github.com/repos/dojiangv/ads-searching-system/issues/comments{/number}","contents_url":"https://api.github.com/repos/dojiangv/ads-searching-system/contents/{+path}","compare_url":"https://api.github.com/repos/dojiangv/ads-searching-system/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dojiangv/ads-searching-system/merges","archive_url":"https://api.github.com/repos/dojiangv/ads-searching-system/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dojiangv/ads-searching-system/downloads","issues_url":"https://api.github.com/repos/dojiangv/ads-searching-system/issues{/number}","pulls_url":"https://api.github.com/repos/dojiangv/ads-searching-system/pulls{/number}","milestones_url":"https://api.github.com/repos/dojiangv/ads-searching-system/milestones{/number}","notifications_url":"https://api.github.com/repos/dojiangv/ads-searching-system/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dojiangv/ads-searching-system/labels{/name}","releases_url":"https://api.github.com/repos/dojiangv/ads-searching-system/releases{/id}","deployments_url":"https://api.github.com/repos/dojiangv/ads-searching-system/deployments","created_at":"2016-06-15T08:50:40Z","updated_at":"2016-06-15T08:50:41Z","pushed_at":"2016-06-21T07:10:14Z","git_url":"git://github.com/dojiangv/ads-searching-system.git","ssh_url":"git@github.com:dojiangv/ads-searching-system.git","clone_url":"https://github.com/dojiangv/ads-searching-system.git","svn_url":"https://github.com/dojiangv/ads-searching-system","homepage":null,"size":23,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"lijljacklee:master","ref":"master","sha":"8cee8ff3f3d91e9833cd0a9ebc704abdf180ee1f","user":{"login":"lijljacklee","id":6657775,"avatar_url":"https://avatars.githubusercontent.com/u/6657775?v=3","gravatar_id":"","url":"https://api.github.com/users/lijljacklee","html_url":"https://github.com/lijljacklee","followers_url":"https://api.github.com/users/lijljacklee/followers","following_url":"https://api.github.com/users/lijljacklee/following{/other_user}","gists_url":"https://api.github.com/users/lijljacklee/gists{/gist_id}","starred_url":"https://api.github.com/users/lijljacklee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lijljacklee/subscriptions","organizations_url":"https://api.github.com/users/lijljacklee/orgs","repos_url":"https://api.github.com/users/lijljacklee/repos","events_url":"https://api.github.com/users/lijljacklee/events{/privacy}","received_events_url":"https://api.github.com/users/lijljacklee/received_events","type":"User","site_admin":false},"repo":{"id":60636766,"name":"ads-searching-system","full_name":"lijljacklee/ads-searching-system","owner":{"login":"lijljacklee","id":6657775,"avatar_url":"https://avatars.githubusercontent.com/u/6657775?v=3","gravatar_id":"","url":"https://api.github.com/users/lijljacklee","html_url":"https://github.com/lijljacklee","followers_url":"https://api.github.com/users/lijljacklee/followers","following_url":"https://api.github.com/users/lijljacklee/following{/other_user}","gists_url":"https://api.github.com/users/lijljacklee/gists{/gist_id}","starred_url":"https://api.github.com/users/lijljacklee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lijljacklee/subscriptions","organizations_url":"https://api.github.com/users/lijljacklee/orgs","repos_url":"https://api.github.com/users/lijljacklee/repos","events_url":"https://api.github.com/users/lijljacklee/events{/privacy}","received_events_url":"https://api.github.com/users/lijljacklee/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lijljacklee/ads-searching-system","description":"This is the project of 2nd team","fork":true,"url":"https://api.github.com/repos/lijljacklee/ads-searching-system","forks_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/forks","keys_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/teams","hooks_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/hooks","issue_events_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/issues/events{/number}","events_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/events","assignees_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/assignees{/user}","branches_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/branches{/branch}","tags_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/tags","blobs_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/git/refs{/sha}","trees_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/statuses/{sha}","languages_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/languages","stargazers_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/stargazers","contributors_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/contributors","subscribers_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/subscribers","subscription_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/subscription","commits_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/commits{/sha}","git_commits_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/git/commits{/sha}","comments_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/comments{/number}","issue_comment_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/issues/comments{/number}","contents_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/contents/{+path}","compare_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/merges","archive_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/downloads","issues_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/issues{/number}","pulls_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls{/number}","milestones_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/milestones{/number}","notifications_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/labels{/name}","releases_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/releases{/id}","deployments_url":"https://api.github.com/repos/lijljacklee/ads-searching-system/deployments","created_at":"2016-06-07T18:31:14Z","updated_at":"2016-06-13T23:12:20Z","pushed_at":"2016-06-21T07:10:14Z","git_url":"git://github.com/lijljacklee/ads-searching-system.git","ssh_url":"git@github.com:lijljacklee/ads-searching-system.git","clone_url":"https://github.com/lijljacklee/ads-searching-system.git","svn_url":"https://github.com/lijljacklee/ads-searching-system","homepage":null,"size":54,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/7"},"html":{"href":"https://github.com/lijljacklee/ads-searching-system/pull/7"},"issue":{"href":"https://api.github.com/repos/lijljacklee/ads-searching-system/issues/7"},"comments":{"href":"https://api.github.com/repos/lijljacklee/ads-searching-system/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lijljacklee/ads-searching-system/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/lijljacklee/ads-searching-system/statuses/931a2c15f80089f7bfd2edfd6f1452288feeca55"}}}}
{"actor":{"display_login":"lijljacklee"}}