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

Thomas Mueller commented on OAK-4313:
-------------------------------------

Sorry I don't understand the logic behind the fix and the test. The assertion 
in the test is a bit strange:

{noformat}
assertTrue(queryType + " query without supporting index mustn't traverse",
                !(index !=null && index instanceof TraversingIndex));
{noformat}

So the test passes if _any_ other index is used (a property index for example). 
Why is the traversing index so bad, and any other index is better? Maybe the 
cost of traversing is lower than the cost of using a property index. A property 
index doesn't support spellcheck and suggest, the same as the traversal index.

Maybe you want to ensure the following:

* (a) if an index supports native queries, then use that one (if multiple such 
indexes are available, use the one with the lowest cost).
* (b) if no such index is available that supports native queries, then return 
no rows in all cases.

If this is correct, then I suggest for the case (b) we use the traverse index, 
but add a new condition that is always wrong (kind of like adding "where 1=0"). 
I can come up with a patch for the query engine.


> QueryImpl should avoid traversal with queries containing native constraints
> ---------------------------------------------------------------------------
>
>                 Key: OAK-4313
>                 URL: https://issues.apache.org/jira/browse/OAK-4313
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: query
>            Reporter: Vikas Saurabh
>            Assignee: Vikas Saurabh
>              Labels: candidate_oak_1_2, candidate_oak_1_4
>             Fix For: 1.6
>
>         Attachments: OAK-4313.patch
>
>
> If no index supports suggestion (or spellcheck or similar) query, then a 
> query like
> {noformat}
> SELECT * from [nt:base] where SUGGEST('test')
> {noformat}
> shouldn't get traversing index



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to