OAK-579 Query: for joins, sometimes no or the wrong index is used

git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1437366 13f79535-47bb-0310-9956-ffa450edef68