{"action":"created","comment":{"url":"https://api.github.com/repos/CTTV/rest_api/pulls/comments/86645460","pull_request_review_id":7295794,"id":86645460,"diff_hunk":"@@ -243,17 +243,27 @@ def best_hit_search(self,\n         #there are len(params.q) responses - one per query\n         for i in range(len(results['responses'])):\n             name = params.q[i]  #even though we are guaranteed that responses come back in order, and can match query to the result - this might be convenient to have       \n+            print \"name =\" + name \n             lower_name = name.lower()\n             res = results['responses'][i]\n             exact_match = False\n             if(res['hits']['total']>0):\n                 hit = res['hits']['hits'][0] #expect either 1 result or none\n                 highlight = ''\n+                fields = kwargs['fields'];\n                 if 'highlight' in hit:\n                     highlight = hit['highlight']\n-                if(lower_name == hit['_source']['approved_symbol'].lower() or lower_name == hit['_id'].lower):\n+                \n+                id_lower = hit['_id'].lower()\n+                type_ = hit['_type']\n+                if (lower_name == id_lower):\n                     exact_match = True\n-                datapoint = dict(type=hit['_type'],\n+                elif (type_ == 'search-object-target' and lower_name == hit['_source']['approved_symbol'].lower()):","path":"app/common/elasticsearchclient.py","position":21,"original_position":21,"commit_id":"d1f4cdb0b37762e027be3c42b2413cb97cfc225a","original_commit_id":"d1f4cdb0b37762e027be3c42b2413cb97cfc225a","user":{"login":"apierleoni","id":148221,"avatar_url":"https://avatars.githubusercontent.com/u/148221?v=3","gravatar_id":"","url":"https://api.github.com/users/apierleoni","html_url":"https://github.com/apierleoni","followers_url":"https://api.github.com/users/apierleoni/followers","following_url":"https://api.github.com/users/apierleoni/following{/other_user}","gists_url":"https://api.github.com/users/apierleoni/gists{/gist_id}","starred_url":"https://api.github.com/users/apierleoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apierleoni/subscriptions","organizations_url":"https://api.github.com/users/apierleoni/orgs","repos_url":"https://api.github.com/users/apierleoni/repos","events_url":"https://api.github.com/users/apierleoni/events{/privacy}","received_events_url":"https://api.github.com/users/apierleoni/received_events","type":"User","site_admin":false},"body":"It would be better to store the type into an enum at the beginning of the file (like the `FreeTextFilterOptions` class above) and check for a parameter of that class. In this way if we change those strings we have a single place to replace them","created_at":"2016-11-04T22:47:13Z","updated_at":"2016-11-04T22:53:45Z","html_url":"https://github.com/CTTV/rest_api/pull/11#discussion_r86645460","pull_request_url":"https://api.github.com/repos/CTTV/rest_api/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/CTTV/rest_api/pulls/comments/86645460"},"html":{"href":"https://github.com/CTTV/rest_api/pull/11#discussion_r86645460"},"pull_request":{"href":"https://api.github.com/repos/CTTV/rest_api/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/CTTV/rest_api/pulls/11","id":92374391,"html_url":"https://github.com/CTTV/rest_api/pull/11","diff_url":"https://github.com/CTTV/rest_api/pull/11.diff","patch_url":"https://github.com/CTTV/rest_api/pull/11.patch","issue_url":"https://api.github.com/repos/CTTV/rest_api/issues/11","number":11,"state":"open","locked":false,"title":"when searching for 'eff' - depending on whether we search filter=target","user":{"login":"rgasparyan","id":1257765,"avatar_url":"https://avatars.githubusercontent.com/u/1257765?v=3","gravatar_id":"","url":"https://api.github.com/users/rgasparyan","html_url":"https://github.com/rgasparyan","followers_url":"https://api.github.com/users/rgasparyan/followers","following_url":"https://api.github.com/users/rgasparyan/following{/other_user}","gists_url":"https://api.github.com/users/rgasparyan/gists{/gist_id}","starred_url":"https://api.github.com/users/rgasparyan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgasparyan/subscriptions","organizations_url":"https://api.github.com/users/rgasparyan/orgs","repos_url":"https://api.github.com/users/rgasparyan/repos","events_url":"https://api.github.com/users/rgasparyan/events{/privacy}","received_events_url":"https://api.github.com/users/rgasparyan/received_events","type":"User","site_admin":false},"body":"or filter=disease or no filter - we should get different results. Also,\r\nsearch fields that we want to get are limited to id and approved_symbol\r\nfor target and is and name for diseases. At least for now. Do not limit\r\nthe fields that come back when there is no filter.\r\n\r\n@apierleoni @emepyc @elipapa ","created_at":"2016-11-04T16:38:45Z","updated_at":"2016-11-04T22:53:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f1d923206020e30dfd4f8171a9677a25787b881e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CTTV/rest_api/pulls/11/commits","review_comments_url":"https://api.github.com/repos/CTTV/rest_api/pulls/11/comments","review_comment_url":"https://api.github.com/repos/CTTV/rest_api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CTTV/rest_api/issues/11/comments","statuses_url":"https://api.github.com/repos/CTTV/rest_api/statuses/d1f4cdb0b37762e027be3c42b2413cb97cfc225a","head":{"label":"CTTV:bestHitSearchFilter","ref":"bestHitSearchFilter","sha":"d1f4cdb0b37762e027be3c42b2413cb97cfc225a","user":{"login":"CTTV","id":8728108,"avatar_url":"https://avatars.githubusercontent.com/u/8728108?v=3","gravatar_id":"","url":"https://api.github.com/users/CTTV","html_url":"https://github.com/CTTV","followers_url":"https://api.github.com/users/CTTV/followers","following_url":"https://api.github.com/users/CTTV/following{/other_user}","gists_url":"https://api.github.com/users/CTTV/gists{/gist_id}","starred_url":"https://api.github.com/users/CTTV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CTTV/subscriptions","organizations_url":"https://api.github.com/users/CTTV/orgs","repos_url":"https://api.github.com/users/CTTV/repos","events_url":"https://api.github.com/users/CTTV/events{/privacy}","received_events_url":"https://api.github.com/users/CTTV/received_events","type":"Organization","site_admin":false},"repo":{"id":49883675,"name":"rest_api","full_name":"CTTV/rest_api","owner":{"login":"CTTV","id":8728108,"avatar_url":"https://avatars.githubusercontent.com/u/8728108?v=3","gravatar_id":"","url":"https://api.github.com/users/CTTV","html_url":"https://github.com/CTTV","followers_url":"https://api.github.com/users/CTTV/followers","following_url":"https://api.github.com/users/CTTV/following{/other_user}","gists_url":"https://api.github.com/users/CTTV/gists{/gist_id}","starred_url":"https://api.github.com/users/CTTV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CTTV/subscriptions","organizations_url":"https://api.github.com/users/CTTV/orgs","repos_url":"https://api.github.com/users/CTTV/repos","events_url":"https://api.github.com/users/CTTV/events{/privacy}","received_events_url":"https://api.github.com/users/CTTV/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CTTV/rest_api","description":"Flask-based Rest API for OpenTargets CoreDB Data","fork":false,"url":"https://api.github.com/repos/CTTV/rest_api","forks_url":"https://api.github.com/repos/CTTV/rest_api/forks","keys_url":"https://api.github.com/repos/CTTV/rest_api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CTTV/rest_api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CTTV/rest_api/teams","hooks_url":"https://api.github.com/repos/CTTV/rest_api/hooks","issue_events_url":"https://api.github.com/repos/CTTV/rest_api/issues/events{/number}","events_url":"https://api.github.com/repos/CTTV/rest_api/events","assignees_url":"https://api.github.com/repos/CTTV/rest_api/assignees{/user}","branches_url":"https://api.github.com/repos/CTTV/rest_api/branches{/branch}","tags_url":"https://api.github.com/repos/CTTV/rest_api/tags","blobs_url":"https://api.github.com/repos/CTTV/rest_api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CTTV/rest_api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CTTV/rest_api/git/refs{/sha}","trees_url":"https://api.github.com/repos/CTTV/rest_api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CTTV/rest_api/statuses/{sha}","languages_url":"https://api.github.com/repos/CTTV/rest_api/languages","stargazers_url":"https://api.github.com/repos/CTTV/rest_api/stargazers","contributors_url":"https://api.github.com/repos/CTTV/rest_api/contributors","subscribers_url":"https://api.github.com/repos/CTTV/rest_api/subscribers","subscription_url":"https://api.github.com/repos/CTTV/rest_api/subscription","commits_url":"https://api.github.com/repos/CTTV/rest_api/commits{/sha}","git_commits_url":"https://api.github.com/repos/CTTV/rest_api/git/commits{/sha}","comments_url":"https://api.github.com/repos/CTTV/rest_api/comments{/number}","issue_comment_url":"https://api.github.com/repos/CTTV/rest_api/issues/comments{/number}","contents_url":"https://api.github.com/repos/CTTV/rest_api/contents/{+path}","compare_url":"https://api.github.com/repos/CTTV/rest_api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CTTV/rest_api/merges","archive_url":"https://api.github.com/repos/CTTV/rest_api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CTTV/rest_api/downloads","issues_url":"https://api.github.com/repos/CTTV/rest_api/issues{/number}","pulls_url":"https://api.github.com/repos/CTTV/rest_api/pulls{/number}","milestones_url":"https://api.github.com/repos/CTTV/rest_api/milestones{/number}","notifications_url":"https://api.github.com/repos/CTTV/rest_api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CTTV/rest_api/labels{/name}","releases_url":"https://api.github.com/repos/CTTV/rest_api/releases{/id}","deployments_url":"https://api.github.com/repos/CTTV/rest_api/deployments","created_at":"2016-01-18T14:54:15Z","updated_at":"2016-10-27T06:39:16Z","pushed_at":"2016-11-04T22:33:00Z","git_url":"git://github.com/CTTV/rest_api.git","ssh_url":"git@github.com:CTTV/rest_api.git","clone_url":"https://github.com/CTTV/rest_api.git","svn_url":"https://github.com/CTTV/rest_api","homepage":"https://www.targetvalidation.org/documentation/api","size":752,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"CTTV:master","ref":"master","sha":"35ec68dca24f185862def268d8253d4844dca8e2","user":{"login":"CTTV","id":8728108,"avatar_url":"https://avatars.githubusercontent.com/u/8728108?v=3","gravatar_id":"","url":"https://api.github.com/users/CTTV","html_url":"https://github.com/CTTV","followers_url":"https://api.github.com/users/CTTV/followers","following_url":"https://api.github.com/users/CTTV/following{/other_user}","gists_url":"https://api.github.com/users/CTTV/gists{/gist_id}","starred_url":"https://api.github.com/users/CTTV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CTTV/subscriptions","organizations_url":"https://api.github.com/users/CTTV/orgs","repos_url":"https://api.github.com/users/CTTV/repos","events_url":"https://api.github.com/users/CTTV/events{/privacy}","received_events_url":"https://api.github.com/users/CTTV/received_events","type":"Organization","site_admin":false},"repo":{"id":49883675,"name":"rest_api","full_name":"CTTV/rest_api","owner":{"login":"CTTV","id":8728108,"avatar_url":"https://avatars.githubusercontent.com/u/8728108?v=3","gravatar_id":"","url":"https://api.github.com/users/CTTV","html_url":"https://github.com/CTTV","followers_url":"https://api.github.com/users/CTTV/followers","following_url":"https://api.github.com/users/CTTV/following{/other_user}","gists_url":"https://api.github.com/users/CTTV/gists{/gist_id}","starred_url":"https://api.github.com/users/CTTV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CTTV/subscriptions","organizations_url":"https://api.github.com/users/CTTV/orgs","repos_url":"https://api.github.com/users/CTTV/repos","events_url":"https://api.github.com/users/CTTV/events{/privacy}","received_events_url":"https://api.github.com/users/CTTV/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CTTV/rest_api","description":"Flask-based Rest API for OpenTargets CoreDB Data","fork":false,"url":"https://api.github.com/repos/CTTV/rest_api","forks_url":"https://api.github.com/repos/CTTV/rest_api/forks","keys_url":"https://api.github.com/repos/CTTV/rest_api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CTTV/rest_api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CTTV/rest_api/teams","hooks_url":"https://api.github.com/repos/CTTV/rest_api/hooks","issue_events_url":"https://api.github.com/repos/CTTV/rest_api/issues/events{/number}","events_url":"https://api.github.com/repos/CTTV/rest_api/events","assignees_url":"https://api.github.com/repos/CTTV/rest_api/assignees{/user}","branches_url":"https://api.github.com/repos/CTTV/rest_api/branches{/branch}","tags_url":"https://api.github.com/repos/CTTV/rest_api/tags","blobs_url":"https://api.github.com/repos/CTTV/rest_api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CTTV/rest_api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CTTV/rest_api/git/refs{/sha}","trees_url":"https://api.github.com/repos/CTTV/rest_api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CTTV/rest_api/statuses/{sha}","languages_url":"https://api.github.com/repos/CTTV/rest_api/languages","stargazers_url":"https://api.github.com/repos/CTTV/rest_api/stargazers","contributors_url":"https://api.github.com/repos/CTTV/rest_api/contributors","subscribers_url":"https://api.github.com/repos/CTTV/rest_api/subscribers","subscription_url":"https://api.github.com/repos/CTTV/rest_api/subscription","commits_url":"https://api.github.com/repos/CTTV/rest_api/commits{/sha}","git_commits_url":"https://api.github.com/repos/CTTV/rest_api/git/commits{/sha}","comments_url":"https://api.github.com/repos/CTTV/rest_api/comments{/number}","issue_comment_url":"https://api.github.com/repos/CTTV/rest_api/issues/comments{/number}","contents_url":"https://api.github.com/repos/CTTV/rest_api/contents/{+path}","compare_url":"https://api.github.com/repos/CTTV/rest_api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CTTV/rest_api/merges","archive_url":"https://api.github.com/repos/CTTV/rest_api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CTTV/rest_api/downloads","issues_url":"https://api.github.com/repos/CTTV/rest_api/issues{/number}","pulls_url":"https://api.github.com/repos/CTTV/rest_api/pulls{/number}","milestones_url":"https://api.github.com/repos/CTTV/rest_api/milestones{/number}","notifications_url":"https://api.github.com/repos/CTTV/rest_api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CTTV/rest_api/labels{/name}","releases_url":"https://api.github.com/repos/CTTV/rest_api/releases{/id}","deployments_url":"https://api.github.com/repos/CTTV/rest_api/deployments","created_at":"2016-01-18T14:54:15Z","updated_at":"2016-10-27T06:39:16Z","pushed_at":"2016-11-04T22:33:00Z","git_url":"git://github.com/CTTV/rest_api.git","ssh_url":"git@github.com:CTTV/rest_api.git","clone_url":"https://github.com/CTTV/rest_api.git","svn_url":"https://github.com/CTTV/rest_api","homepage":"https://www.targetvalidation.org/documentation/api","size":752,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CTTV/rest_api/pulls/11"},"html":{"href":"https://github.com/CTTV/rest_api/pull/11"},"issue":{"href":"https://api.github.com/repos/CTTV/rest_api/issues/11"},"comments":{"href":"https://api.github.com/repos/CTTV/rest_api/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/CTTV/rest_api/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/CTTV/rest_api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CTTV/rest_api/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/CTTV/rest_api/statuses/d1f4cdb0b37762e027be3c42b2413cb97cfc225a"}}}}
{"actor":{"display_login":"apierleoni"}}