{"action":"created","issue":{"url":"https://api.github.com/repos/JanusGraph/janusgraph/issues/927","repository_url":"https://api.github.com/repos/JanusGraph/janusgraph","labels_url":"https://api.github.com/repos/JanusGraph/janusgraph/issues/927/labels{/name}","comments_url":"https://api.github.com/repos/JanusGraph/janusgraph/issues/927/comments","events_url":"https://api.github.com/repos/JanusGraph/janusgraph/issues/927/events","html_url":"https://github.com/JanusGraph/janusgraph/pull/927","id":296193435,"number":927,"title":"Add better OR support for mixed indexes.","user":{"login":"davidclement90","id":20819752,"avatar_url":"https://avatars2.githubusercontent.com/u/20819752?v=4","gravatar_id":"","url":"https://api.github.com/users/davidclement90","html_url":"https://github.com/davidclement90","followers_url":"https://api.github.com/users/davidclement90/followers","following_url":"https://api.github.com/users/davidclement90/following{/other_user}","gists_url":"https://api.github.com/users/davidclement90/gists{/gist_id}","starred_url":"https://api.github.com/users/davidclement90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidclement90/subscriptions","organizations_url":"https://api.github.com/users/davidclement90/orgs","repos_url":"https://api.github.com/users/davidclement90/repos","events_url":"https://api.github.com/users/davidclement90/events{/privacy}","received_events_url":"https://api.github.com/users/davidclement90/received_events","type":"User","site_admin":false},"labels":[{"id":507215572,"url":"https://api.github.com/repos/JanusGraph/janusgraph/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false},{"id":507186125,"url":"https://api.github.com/repos/JanusGraph/janusgraph/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/JanusGraph/janusgraph/milestones/4","html_url":"https://github.com/JanusGraph/janusgraph/milestone/4","labels_url":"https://api.github.com/repos/JanusGraph/janusgraph/milestones/4/labels","id":2802018,"number":4,"title":"Release v0.3.0","description":"","creator":{"login":"sjudeng","id":11000076,"avatar_url":"https://avatars3.githubusercontent.com/u/11000076?v=4","gravatar_id":"","url":"https://api.github.com/users/sjudeng","html_url":"https://github.com/sjudeng","followers_url":"https://api.github.com/users/sjudeng/followers","following_url":"https://api.github.com/users/sjudeng/following{/other_user}","gists_url":"https://api.github.com/users/sjudeng/gists{/gist_id}","starred_url":"https://api.github.com/users/sjudeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjudeng/subscriptions","organizations_url":"https://api.github.com/users/sjudeng/orgs","repos_url":"https://api.github.com/users/sjudeng/repos","events_url":"https://api.github.com/users/sjudeng/events{/privacy}","received_events_url":"https://api.github.com/users/sjudeng/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":79,"state":"open","created_at":"2017-09-29T04:07:52Z","updated_at":"2018-02-11T14:21:10Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2018-02-11T14:19:36Z","updated_at":"2018-02-11T18:46:29Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/JanusGraph/janusgraph/pulls/927","html_url":"https://github.com/JanusGraph/janusgraph/pull/927","diff_url":"https://github.com/JanusGraph/janusgraph/pull/927.diff","patch_url":"https://github.com/JanusGraph/janusgraph/pull/927.patch"},"body":"Issue : #163\r\nThis PR add better OR support.\r\nIf one backend can handle the all query, we use this backend\r\nIf not it will create one query by OR's child\r\n\r\nNow all these queries can use indexes instead of using full-scan\r\n```\r\ng.V().or(__.has(\"name\", \"Hiro\"),__.has(\"age\", 2)));\r\ng.V().or(__.has(\"name\", \"Totoro\"),__.has(\"age\", 2)));\r\ng.V().or(__.has(\"name\", \"Totoro\").has(\"age\", 1),__.has(\"age\", 2)));\r\ng.V().or(__.and(__.has(\"name\", \"Totoro\"), __.has(\"age\", 1)),__.has(\"age\", 2)));\r\ng.V().has(\"length\", P.lte(100)).or(__.has(\"name\", \"Totoro\"),__.has(\"age\", P.gte(2)))\r\ng.V().or(__.has(\"name\", \"Totoro\"),__.has(\"age\", P.gte(2))).has(\"length\", P.lte(100))\r\ng.V().or(__.has(\"name\", \"Totoro\"),__.has(\"age\", 2)).order().by(\"age\")\r\ng.V().or(__.has(\"name\", \"Totoro\"), __.has(\"length\", P.lte(120)).order().by(\"length\"))\r\ng.V().or(__.has(\"name\", \"Totoro\"), __.has(\"length\", P.lte(120)).order()\r\n.by(\"length\")).order().by(\"age\")\r\ng.V().or(__.has(\"name\", \"Totoro\"), __.has(\"length\", P.lte(120))).order().by(\"age\").limit(2)\r\ng.V().or(__.has(\"name\", \"Totoro\"), __.has(\"length\", P.lte(120))).order().by(\"age\")\r\n.range(2, 3)\r\ng.V().has(\"length\", P.gte(130).or(P.lt(100))).order().by(\"age\")\r\ng.V().has(\"length\", P.gte(80).and(P.gte(130).or(P.lt(100)))).order().by(\"age\")\r\n```\r\nIf the backend can handle not query-normal-form as Elasticsearch or Lucene, the query will use mixed indexes :\r\n`g.V().has(\"length\", P.gte(80).and(P.gte(130)).or(P.gte(80).and(P.lt(100))))`\r\n\r\nSigned-off-by: David Clement <david.clement90@laposte.net>\r\n\r\n-----\r\n\r\nThank you for contributing to JanusGraph!\r\n\r\nIn order to streamline the review of the contribution we ask you\r\nto ensure the following steps have been taken:\r\n\r\n### For all changes:\r\n- [x] Is there an issue associated with this PR? Is it referenced in the commit message?\r\n- [x] Does your PR body contain #xyz where xyz is the issue number you are trying to resolve?\r\n- [x] Has your PR been rebased against the latest commit within the target branch (typically `master`)?\r\n- [x] Is your initial contribution a single, squashed commit?\r\n\r\n### For code changes:\r\n- [x] Have you written and/or updated unit tests to verify your changes?\r\n- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?\r\n- [ ] If applicable, have you updated the LICENSE.txt file, including the main LICENSE.txt file in the root of this repository?\r\n- [ ] If applicable, have you updated the NOTICE.txt file, including the main NOTICE.txt file found in the root of this repository?\r\n\r\n### For documentation related changes:\r\n- [x] Have you ensured that format looks appropriate for the output in which it is rendered?\r\n- [ ] If this PR is a documentation-only change, have you added a `[skip ci]`\r\n  tag to the first line of your commit message to avoid spending CPU cycles in\r\n  Travis CI when no code, tests, or build configuration are modified?\r\n\r\n### Note:\r\nPlease ensure that once the PR is submitted, you check Travis CI for build issues and submit an update to your PR as soon as possible.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/JanusGraph/janusgraph/issues/comments/364776474","html_url":"https://github.com/JanusGraph/janusgraph/pull/927#issuecomment-364776474","issue_url":"https://api.github.com/repos/JanusGraph/janusgraph/issues/927","id":364776474,"user":{"login":"davidclement90","id":20819752,"avatar_url":"https://avatars2.githubusercontent.com/u/20819752?v=4","gravatar_id":"","url":"https://api.github.com/users/davidclement90","html_url":"https://github.com/davidclement90","followers_url":"https://api.github.com/users/davidclement90/followers","following_url":"https://api.github.com/users/davidclement90/following{/other_user}","gists_url":"https://api.github.com/users/davidclement90/gists{/gist_id}","starred_url":"https://api.github.com/users/davidclement90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidclement90/subscriptions","organizations_url":"https://api.github.com/users/davidclement90/orgs","repos_url":"https://api.github.com/users/davidclement90/repos","events_url":"https://api.github.com/users/davidclement90/events{/privacy}","received_events_url":"https://api.github.com/users/davidclement90/received_events","type":"User","site_admin":false},"created_at":"2018-02-11T18:46:29Z","updated_at":"2018-02-11T18:46:29Z","author_association":"CONTRIBUTOR","body":"No worries take your time.\r\nIf you can check this one https://github.com/JanusGraph/janusgraph/pull/873 before because both PR change the same class (janusgraph-core/src/main/java/org/janusgraph/graphdb/tinkerpop/optimize/HasStepFolder.java). So to make the merge simpler, I prefer to merge https://github.com/JanusGraph/janusgraph/pull/873 before this one."}}
{"actor":{"display_login":"davidclement90"}}