[
https://issues.apache.org/jira/browse/OAK-1405?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13907084#comment-13907084
]
Thomas Mueller commented on OAK-1405:
-------------------------------------
Hi,
I'm not quite sure, maybe the problem is already fixed in the current trunk,
and what you see is a duplicate of OAK-1432. I converted the two XPath
statements to SQL-2 and got the following results:
{noformat}
//element(*, dam:Asset)[jcr:content/metadata/@cq:tags = 'abc'
or jcr:content/metadata/@cq:tags = 'abc'
or jcr:like(jcr:content/metadata/@cq:tags,'stockphotography:business')]
select [jcr:path], [jcr:score], *
from [dam:Asset] as a
where [jcr:content/metadata/cq:tags] = 'abc'
or [jcr:content/metadata/cq:tags] = 'abc'
union select [jcr:path], [jcr:score], *
from [dam:Asset] as a
where [jcr:content/metadata/cq:tags] like 'stockphotography:business'
//element(*, dam:Asset)[jcr:content/metadata/@cq:tags = 'abc'
or jcr:like(jcr:content/metadata/@cq:tags,'stockphotography:business')
or jcr:content/metadata/@cq:tags = 'abc']
select [jcr:path], [jcr:score], *
from [dam:Asset] as a
where [jcr:content/metadata/cq:tags] = 'abc'
union select [jcr:path], [jcr:score], *
from [dam:Asset] as a
where [jcr:content/metadata/cq:tags] like 'stockphotography:business'
union select [jcr:path], [jcr:score], *
from [dam:Asset] as a
where [jcr:content/metadata/cq:tags] = 'abc'
{noformat}
So both are now union queries, and can use an index on "cq:tags". The first
query only has two union queries, not three, because the converter detects the
property is the same, and the SQL-2 parser will convert that to
[jcr:content/metadata/cq:tags] in ('abc', 'abc'). For the second case this is
not detected, but that shouldn't matter much.
As for the jcr:like: you are not actually using a search pattern with
wildcards, why do you use "jcr:like" and not simply "=" ? Please note when
using jcr:like, the property index on "cq:tags" can not be used, and a
traversal would be needed, which is very slow.
> OR of different constraints broken
> ----------------------------------
>
> Key: OAK-1405
> URL: https://issues.apache.org/jira/browse/OAK-1405
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: query
> Affects Versions: 0.15
> Reporter: Ankush Malhotra
> Assignee: Thomas Mueller
> Fix For: 0.17a
>
>
> There is a peculiar search bug on load 16 that 'OR' of 3 constraints is
> broken but removing any one returns the results. The below query returns no
> results but removing any one of 3 'OR'ed conditions returns the result.
> //*[( jcr:content/metadata/@cq:tags = 'stockphotography:business' or
> jcr:like(jcr:content/metadata/@cq:tags, 'stockphotography:business/%') or
> jcr:content/metadata/@cq:tags = '/etc/tags/stockphotography/business') ]
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)