[
https://issues.apache.org/jira/browse/OAK-955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13736722#comment-13736722
]
Thomas Mueller commented on OAK-955:
------------------------------------
> will trick the query engine into picking a property index, failing the test
> because is returns more results than it should.
Just because the query index uses the wrong index should result in a test
failure, unless the full-text evaluation within the query engine doesn't work
as expected.
The last part of the condition (contains OR type=x AND contains) can be written
as (contains OR (type=x AND contains)).
Because of the "OR", the query engine doesn't set the full-text constraint in
any filter (both the filter for selector a and the filter for selector b):
* Adding the full-text constraint to the filter of selector a (CONTAINS(a.*,
'testJoinWithOR4')) wouldn't work, as it would incorrectly filter out nodes
where a.type = 'child' and the joined node on selector b contains
'testJoinWithOR4'.
* Adding the full-text constraint to the filter of selector b (CONTAINS(b.*,
'testJoinWithOR4')) wouldn't work, as it would incorrectly filter out nodes
where b.type = 'parent' and the joined node on selector a contains
'testJoinWithOR4'.
That's why the only constraint for selector a is "a.type = 'child'".
The query engine currently gets the nodes of selector a first, and then queries
for nodes on selector b using the join condition (b.[jcr:uuid] = a.testref).
In order to use a full-text index, what the query engine could do here is:
first convert the condition "a and (b or (c and d))" to "(a and b) or (a and c
and d)", then convert that to a union. It is already possible to do that
manually, see also OAK-904, but it isn't done automatically yet. Possibly
another type of "union" on the index level rather than on the query level
should be used.
> Query: Filter doesn't contain fulltext constraints from joins
> --------------------------------------------------------------
>
> Key: OAK-955
> URL: https://issues.apache.org/jira/browse/OAK-955
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: core, query
> Reporter: Alex Parvulescu
> Priority: Minor
>
> Example query:
> {code}
> SELECT a.*
> FROM [nt:unstructured] AS a
> INNER JOIN [nt:unstructured] AS b
> ON b.[jcr:uuid] = a.testref
> WHERE a.type = 'child'
> AND (CONTAINS(a.*, 'testJoinWithOR4') OR b.type = 'parent' AND CONTAINS(b.*,
> 'testJoinWithOR4'))
> {code}
> I'm not sure why this happens, but I noticed stepping through the code that
> the filter generated on the query doesn't contain any fulltext constraints.
> It does however contain the 'type' info which will trick the query engine
> into picking a property index, failing the test because is returns more
> results than it should.
> See failing tests on the lucene module:
> - org.apache.jackrabbit.core.query.JoinTest#testJoinWithOR4
> - org.apache.jackrabbit.core.query.JoinTest#testJoinWithOR5
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira