{"action":"created","comment":{"url":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/comments/44407390","id":44407390,"diff_hunk":"@@ -0,0 +1,203 @@\n+# -*- coding: utf-8 -*-\n+#\n+# This file is part of Invenio.\n+# Copyright (C) 2015 CERN.\n+#\n+# Invenio is free software; you can redistribute it\n+# and/or modify it under the terms of the GNU General Public License as\n+# published by the Free Software Foundation; either version 2 of the\n+# License, or (at your option) any later version.\n+#\n+# Invenio is distributed in the hope that it will be\n+# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+# General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with Invenio; if not, write to the\n+# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,\n+# MA 02111-1307, USA.\n+#\n+# In applying this license, CERN does not\n+# waive the privileges and immunities granted to it by virtue of its status\n+# as an Intergovernmental Organization or submit itself to any jurisdiction.\n+\n+\"\"\"Invenio Matcher Elasticsearch engine.\"\"\"\n+\n+from flask import current_app\n+\n+from invenio.base.wrappers import lazy_import\n+\n+from invenio_matcher.errors import InvalidCall\n+from invenio_matcher.errors import NoQueryDefined\n+from invenio_matcher.models import MatchResult\n+\n+import six\n+\n+from werkzeug.utils import import_string\n+\n+\n+ES = lazy_import('invenio.ext.es.es')\n+Record = lazy_import('invenio_records.api.Record')\n+\n+\n+def exact(**kwargs):\n+    \"\"\"Build an exact query and send it to Elasticsearch.\"\"\"\n+    return _query(_build_exact_query, **kwargs)\n+\n+\n+def fuzzy(**kwargs):\n+    \"\"\"Build a fuzzy query and send it to Elasticsearch.\"\"\"\n+    return _query(_build_fuzzy_query, **kwargs)\n+\n+\n+def free(**kwargs):\n+    \"\"\"Build a free query and send it to Elasticsearch.\"\"\"\n+    return _query(_build_free_query, **kwargs)\n+\n+\n+def queries(**kwargs):\n+    \"\"\"Return queries defined for the given index and doc_type.\"\"\"\n+    try:","path":"invenio_matcher/matcherext/engines/es.py","position":61,"original_position":61,"commit_id":"f395c313a0738ccb2a616b980c71e3d4a0f09e51","original_commit_id":"f395c313a0738ccb2a616b980c71e3d4a0f09e51","user":{"login":"jacquerie","id":381280,"avatar_url":"https://avatars.githubusercontent.com/u/381280?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquerie","html_url":"https://github.com/jacquerie","followers_url":"https://api.github.com/users/jacquerie/followers","following_url":"https://api.github.com/users/jacquerie/following{/other_user}","gists_url":"https://api.github.com/users/jacquerie/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquerie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquerie/subscriptions","organizations_url":"https://api.github.com/users/jacquerie/orgs","repos_url":"https://api.github.com/users/jacquerie/repos","events_url":"https://api.github.com/users/jacquerie/events{/privacy}","received_events_url":"https://api.github.com/users/jacquerie/received_events","type":"User","site_admin":false},"body":"Wait. `engine.py` can not know that it should call `exact(index, doc_type, **kwargs)`, since it's an implementation detail specific to Elasticsearch, so it has to call `exact(**kwargs)`. What I can do is move the logic that checks for required keyword arguments in a decorator, so that the code reads nicer. Would that be ok?","created_at":"2015-11-10T13:49:08Z","updated_at":"2015-11-10T13:49:08Z","html_url":"https://github.com/inspirehep/invenio-matcher/pull/4#discussion_r44407390","pull_request_url":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/comments/44407390"},"html":{"href":"https://github.com/inspirehep/invenio-matcher/pull/4#discussion_r44407390"},"pull_request":{"href":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/4","id":49982542,"html_url":"https://github.com/inspirehep/invenio-matcher/pull/4","diff_url":"https://github.com/inspirehep/invenio-matcher/pull/4.diff","patch_url":"https://github.com/inspirehep/invenio-matcher/pull/4.patch","issue_url":"https://api.github.com/repos/inspirehep/invenio-matcher/issues/4","number":4,"state":"open","locked":false,"title":"WIP: new architecture","user":{"login":"jacquerie","id":381280,"avatar_url":"https://avatars.githubusercontent.com/u/381280?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquerie","html_url":"https://github.com/jacquerie","followers_url":"https://api.github.com/users/jacquerie/followers","following_url":"https://api.github.com/users/jacquerie/following{/other_user}","gists_url":"https://api.github.com/users/jacquerie/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquerie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquerie/subscriptions","organizations_url":"https://api.github.com/users/jacquerie/orgs","repos_url":"https://api.github.com/users/jacquerie/repos","events_url":"https://api.github.com/users/jacquerie/events{/privacy}","received_events_url":"https://api.github.com/users/jacquerie/received_events","type":"User","site_admin":false},"body":"Following #2, here's my proposal for `invenio-matcher`.\r\n\r\nWhat's missing:\r\n- [x] A good commit message.\r\n- [x] Some docstrings.\r\n- [ ] Proper error reporting (the error messages are just `TODO`).\r\n- [ ] Packaging and distribution (I might need @jalavik's assistance for this).\r\n","created_at":"2015-11-06T17:39:44Z","updated_at":"2015-11-10T13:49:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7b756e6c829e27c66757da671301930110ad3f51","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/4/commits","review_comments_url":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/4/comments","review_comment_url":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/comments{/number}","comments_url":"https://api.github.com/repos/inspirehep/invenio-matcher/issues/4/comments","statuses_url":"https://api.github.com/repos/inspirehep/invenio-matcher/statuses/f395c313a0738ccb2a616b980c71e3d4a0f09e51","head":{"label":"jacquerie:new-architecture","ref":"new-architecture","sha":"f395c313a0738ccb2a616b980c71e3d4a0f09e51","user":{"login":"jacquerie","id":381280,"avatar_url":"https://avatars.githubusercontent.com/u/381280?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquerie","html_url":"https://github.com/jacquerie","followers_url":"https://api.github.com/users/jacquerie/followers","following_url":"https://api.github.com/users/jacquerie/following{/other_user}","gists_url":"https://api.github.com/users/jacquerie/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquerie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquerie/subscriptions","organizations_url":"https://api.github.com/users/jacquerie/orgs","repos_url":"https://api.github.com/users/jacquerie/repos","events_url":"https://api.github.com/users/jacquerie/events{/privacy}","received_events_url":"https://api.github.com/users/jacquerie/received_events","type":"User","site_admin":false},"repo":{"id":45696986,"name":"invenio-matcher","full_name":"jacquerie/invenio-matcher","owner":{"login":"jacquerie","id":381280,"avatar_url":"https://avatars.githubusercontent.com/u/381280?v=3","gravatar_id":"","url":"https://api.github.com/users/jacquerie","html_url":"https://github.com/jacquerie","followers_url":"https://api.github.com/users/jacquerie/followers","following_url":"https://api.github.com/users/jacquerie/following{/other_user}","gists_url":"https://api.github.com/users/jacquerie/gists{/gist_id}","starred_url":"https://api.github.com/users/jacquerie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacquerie/subscriptions","organizations_url":"https://api.github.com/users/jacquerie/orgs","repos_url":"https://api.github.com/users/jacquerie/repos","events_url":"https://api.github.com/users/jacquerie/events{/privacy}","received_events_url":"https://api.github.com/users/jacquerie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jacquerie/invenio-matcher","description":"Invenio package for matching bibliographic meta-data records against the repository.","fork":true,"url":"https://api.github.com/repos/jacquerie/invenio-matcher","forks_url":"https://api.github.com/repos/jacquerie/invenio-matcher/forks","keys_url":"https://api.github.com/repos/jacquerie/invenio-matcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jacquerie/invenio-matcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jacquerie/invenio-matcher/teams","hooks_url":"https://api.github.com/repos/jacquerie/invenio-matcher/hooks","issue_events_url":"https://api.github.com/repos/jacquerie/invenio-matcher/issues/events{/number}","events_url":"https://api.github.com/repos/jacquerie/invenio-matcher/events","assignees_url":"https://api.github.com/repos/jacquerie/invenio-matcher/assignees{/user}","branches_url":"https://api.github.com/repos/jacquerie/invenio-matcher/branches{/branch}","tags_url":"https://api.github.com/repos/jacquerie/invenio-matcher/tags","blobs_url":"https://api.github.com/repos/jacquerie/invenio-matcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jacquerie/invenio-matcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jacquerie/invenio-matcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/jacquerie/invenio-matcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jacquerie/invenio-matcher/statuses/{sha}","languages_url":"https://api.github.com/repos/jacquerie/invenio-matcher/languages","stargazers_url":"https://api.github.com/repos/jacquerie/invenio-matcher/stargazers","contributors_url":"https://api.github.com/repos/jacquerie/invenio-matcher/contributors","subscribers_url":"https://api.github.com/repos/jacquerie/invenio-matcher/subscribers","subscription_url":"https://api.github.com/repos/jacquerie/invenio-matcher/subscription","commits_url":"https://api.github.com/repos/jacquerie/invenio-matcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/jacquerie/invenio-matcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/jacquerie/invenio-matcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/jacquerie/invenio-matcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/jacquerie/invenio-matcher/contents/{+path}","compare_url":"https://api.github.com/repos/jacquerie/invenio-matcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jacquerie/invenio-matcher/merges","archive_url":"https://api.github.com/repos/jacquerie/invenio-matcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jacquerie/invenio-matcher/downloads","issues_url":"https://api.github.com/repos/jacquerie/invenio-matcher/issues{/number}","pulls_url":"https://api.github.com/repos/jacquerie/invenio-matcher/pulls{/number}","milestones_url":"https://api.github.com/repos/jacquerie/invenio-matcher/milestones{/number}","notifications_url":"https://api.github.com/repos/jacquerie/invenio-matcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jacquerie/invenio-matcher/labels{/name}","releases_url":"https://api.github.com/repos/jacquerie/invenio-matcher/releases{/id}","created_at":"2015-11-06T17:35:20Z","updated_at":"2015-11-06T17:35:20Z","pushed_at":"2015-11-07T20:04:06Z","git_url":"git://github.com/jacquerie/invenio-matcher.git","ssh_url":"git@github.com:jacquerie/invenio-matcher.git","clone_url":"https://github.com/jacquerie/invenio-matcher.git","svn_url":"https://github.com/jacquerie/invenio-matcher","homepage":null,"size":115,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"inspirehep:master","ref":"master","sha":"53059dcce24b8eec91915aa504a9124e9769859b","user":{"login":"inspirehep","id":356664,"avatar_url":"https://avatars.githubusercontent.com/u/356664?v=3","gravatar_id":"","url":"https://api.github.com/users/inspirehep","html_url":"https://github.com/inspirehep","followers_url":"https://api.github.com/users/inspirehep/followers","following_url":"https://api.github.com/users/inspirehep/following{/other_user}","gists_url":"https://api.github.com/users/inspirehep/gists{/gist_id}","starred_url":"https://api.github.com/users/inspirehep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inspirehep/subscriptions","organizations_url":"https://api.github.com/users/inspirehep/orgs","repos_url":"https://api.github.com/users/inspirehep/repos","events_url":"https://api.github.com/users/inspirehep/events{/privacy}","received_events_url":"https://api.github.com/users/inspirehep/received_events","type":"Organization","site_admin":false},"repo":{"id":40600736,"name":"invenio-matcher","full_name":"inspirehep/invenio-matcher","owner":{"login":"inspirehep","id":356664,"avatar_url":"https://avatars.githubusercontent.com/u/356664?v=3","gravatar_id":"","url":"https://api.github.com/users/inspirehep","html_url":"https://github.com/inspirehep","followers_url":"https://api.github.com/users/inspirehep/followers","following_url":"https://api.github.com/users/inspirehep/following{/other_user}","gists_url":"https://api.github.com/users/inspirehep/gists{/gist_id}","starred_url":"https://api.github.com/users/inspirehep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inspirehep/subscriptions","organizations_url":"https://api.github.com/users/inspirehep/orgs","repos_url":"https://api.github.com/users/inspirehep/repos","events_url":"https://api.github.com/users/inspirehep/events{/privacy}","received_events_url":"https://api.github.com/users/inspirehep/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/inspirehep/invenio-matcher","description":"Invenio package for matching bibliographic meta-data records against the repository.","fork":false,"url":"https://api.github.com/repos/inspirehep/invenio-matcher","forks_url":"https://api.github.com/repos/inspirehep/invenio-matcher/forks","keys_url":"https://api.github.com/repos/inspirehep/invenio-matcher/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inspirehep/invenio-matcher/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inspirehep/invenio-matcher/teams","hooks_url":"https://api.github.com/repos/inspirehep/invenio-matcher/hooks","issue_events_url":"https://api.github.com/repos/inspirehep/invenio-matcher/issues/events{/number}","events_url":"https://api.github.com/repos/inspirehep/invenio-matcher/events","assignees_url":"https://api.github.com/repos/inspirehep/invenio-matcher/assignees{/user}","branches_url":"https://api.github.com/repos/inspirehep/invenio-matcher/branches{/branch}","tags_url":"https://api.github.com/repos/inspirehep/invenio-matcher/tags","blobs_url":"https://api.github.com/repos/inspirehep/invenio-matcher/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inspirehep/invenio-matcher/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inspirehep/invenio-matcher/git/refs{/sha}","trees_url":"https://api.github.com/repos/inspirehep/invenio-matcher/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inspirehep/invenio-matcher/statuses/{sha}","languages_url":"https://api.github.com/repos/inspirehep/invenio-matcher/languages","stargazers_url":"https://api.github.com/repos/inspirehep/invenio-matcher/stargazers","contributors_url":"https://api.github.com/repos/inspirehep/invenio-matcher/contributors","subscribers_url":"https://api.github.com/repos/inspirehep/invenio-matcher/subscribers","subscription_url":"https://api.github.com/repos/inspirehep/invenio-matcher/subscription","commits_url":"https://api.github.com/repos/inspirehep/invenio-matcher/commits{/sha}","git_commits_url":"https://api.github.com/repos/inspirehep/invenio-matcher/git/commits{/sha}","comments_url":"https://api.github.com/repos/inspirehep/invenio-matcher/comments{/number}","issue_comment_url":"https://api.github.com/repos/inspirehep/invenio-matcher/issues/comments{/number}","contents_url":"https://api.github.com/repos/inspirehep/invenio-matcher/contents/{+path}","compare_url":"https://api.github.com/repos/inspirehep/invenio-matcher/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inspirehep/invenio-matcher/merges","archive_url":"https://api.github.com/repos/inspirehep/invenio-matcher/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inspirehep/invenio-matcher/downloads","issues_url":"https://api.github.com/repos/inspirehep/invenio-matcher/issues{/number}","pulls_url":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls{/number}","milestones_url":"https://api.github.com/repos/inspirehep/invenio-matcher/milestones{/number}","notifications_url":"https://api.github.com/repos/inspirehep/invenio-matcher/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inspirehep/invenio-matcher/labels{/name}","releases_url":"https://api.github.com/repos/inspirehep/invenio-matcher/releases{/id}","created_at":"2015-08-12T13:00:33Z","updated_at":"2015-08-20T09:34:39Z","pushed_at":"2015-11-07T20:04:06Z","git_url":"git://github.com/inspirehep/invenio-matcher.git","ssh_url":"git@github.com:inspirehep/invenio-matcher.git","clone_url":"https://github.com/inspirehep/invenio-matcher.git","svn_url":"https://github.com/inspirehep/invenio-matcher","homepage":null,"size":148,"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":4,"forks":1,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/4"},"html":{"href":"https://github.com/inspirehep/invenio-matcher/pull/4"},"issue":{"href":"https://api.github.com/repos/inspirehep/invenio-matcher/issues/4"},"comments":{"href":"https://api.github.com/repos/inspirehep/invenio-matcher/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/inspirehep/invenio-matcher/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/inspirehep/invenio-matcher/statuses/f395c313a0738ccb2a616b980c71e3d4a0f09e51"}}}}