[ 
https://issues.apache.org/jira/browse/OAK-1965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14064988#comment-14064988
 ] 

Jukka Zitting commented on OAK-1965:
------------------------------------

FTR, here's how to use this improvement:

* Assume you have queries with OR constraints containing equality or IN tests 
for more than a single property from one selector, like the {{[foo] = 'X' OR 
[bar] = 'Y'}} constraint from above. Previously it was not possible to use an 
index to speed up the evaluation of such constraints.
* Configure a property index whose {{propertyNames}} list includes all the 
properties you expect to use in such queries. For example, a "fooBarIndex" with 
{{propertyNames = ['foo', 'bar']}} for the query above.
* With this improvement the property index will automatically detect such an OR 
constraint and treat it as an "extended IN" constraint like {{([foo] OR [bar]) 
IN ('X', 'Y')}} that can be evaluated against the configured index since it 
covers the values of both properties.
* To verify that this functionality is indeed in place, you can use the 
{{EXPLAIN}} feature or debug logging of the query engine to check that the 
query plan mentions "property fooBarIndex IN (foo, bar)" as the index and 
constraints being used.

> Support for constraints like: foo = 'X' OR bar = 'Y'
> ----------------------------------------------------
>
>                 Key: OAK-1965
>                 URL: https://issues.apache.org/jira/browse/OAK-1965
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core, query
>            Reporter: Jukka Zitting
>            Assignee: Jukka Zitting
>             Fix For: 1.1
>
>
> Consider the following query statement:
> {noformat}
> SELECT * FROM [nt:base] WHERE [foo] = 'X OR [bar] = 'Y'
> {noformat}
> Such a query could be fairly efficiently executed against a property index 
> that indexes the values of both "foo" and "bar" properties. However, the 
> query engine doesn't pass such OR constraints down to the index 
> implementations, so we currently can't leverage such an index for this query.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to