You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Christoph Kiehl (JIRA)" <ji...@apache.org> on 2007/06/11 11:13:26 UTC

[jira] Created: (JCR-967) Only search the index for the "jcr:system" tree if needed

Only search the index for the "jcr:system" tree if needed
---------------------------------------------------------

                 Key: JCR-967
                 URL: https://issues.apache.org/jira/browse/JCR-967
             Project: Jackrabbit
          Issue Type: Improvement
          Components: query
    Affects Versions: 1.3
            Reporter: Christoph Kiehl


Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:

- what's the first location step and does it include the jcr:system tree? I think that's an easy one.
- does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 

This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl updated JCR-967:
--------------------------------

    Attachment:     (was: patch.txt)

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl updated JCR-967:
--------------------------------

    Attachment:     (was: patch.txt)

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>         Attachments: patch.txt
>
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl updated JCR-967:
--------------------------------

    Attachment:     (was: patch.txt)

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>         Attachments: patch.txt
>
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl updated JCR-967:
--------------------------------

    Attachment: patch.txt

Attached revised patch which corrects behaviour for PathQueryNode

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>         Attachments: patch.txt
>
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Paco Avila (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503359 ] 

Paco Avila commented on JCR-967:
--------------------------------

Ups, I didn't notice it. So, this would be a huge performance improvement on searchs...

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl updated JCR-967:
--------------------------------

    Attachment: patch.txt

This is an initial patch which checks the first location step for "jcr:system". This might not be enough since "jcr:system" might be reachable through the parent operator "..". Not sure about this though.
I didn't implement the check deref nodes. Right any deref node should lead to an inclusion of the system tree index. I'm not sure if it's worth the hassle because for large result sets it might lead to performance degradation because every uuid has to be checked if its item is located under jcr:system.
I chose to implement this check through QueryNode because I think this would be less error prone than implement the whole check in QueryImpl because then QueryImpl has to know about every implementation of QueryNode. As it is now every QueryNode implementation is responsible for itself if it needs the system tree index to be included in the search.

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>         Attachments: patch.txt
>
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl updated JCR-967:
--------------------------------

    Attachment: patch.txt

This patch works with "//test/*" as well. I extended the test case.

I didn't provide a default implementation of needsSystemTree() on purpose because I wanted to force everyone extending QueryNode to think about if his implementation needs the system tree or not. If we provide a default implementation that returns false this might lead to unexpected behaviour if one expects the system tree to be included. We could provide a default implemenation that returns true but then we would have to override the methods anyway in almost all QueryNode implemenations to return false.

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>         Attachments: patch.txt
>
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503354 ] 

Christoph Kiehl commented on JCR-967:
-------------------------------------

Even if you do exclude jcr:system in your query jackrabbit currently searches the lucene index for jcr:system as well although the resultset for that index will be empty.

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marcel Reutegger resolved JCR-967.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4

> I didn't provide a default implementation of needsSystemTree() on purpose because I wanted
> to force everyone extending QueryNode to think about if his implementation needs the system
> tree or not.

Ok, fair enough.

Based on your ASF license grant on the patch I added a license header to PathQueryNodeTest, which was missing. I also added JavaDoc to the new method SearchIndex.getIndexReader(boolean) and opened up the visibility to protected.

Thanks a lot for your work!

Committed the patch in revision: 550419

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>             Fix For: 1.4
>
>         Attachments: patch.txt
>
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Christoph Kiehl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christoph Kiehl updated JCR-967:
--------------------------------

    Attachment: patch.txt

Revised patch with unit test and some bugs fixed

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>         Attachments: patch.txt
>
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-967:
------------------------------

          Component/s: jackrabbit-core
    Affects Version/s:     (was: 1.3)

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: jackrabbit-core, query
>            Reporter: Christoph Kiehl
>             Fix For: 1.4
>
>         Attachments: patch.txt
>
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506531 ] 

Marcel Reutegger commented on JCR-967:
--------------------------------------

Looks good to me. Just one minor comment. I suggest we provide a default implementation QueryNode.needsSystemTree(), which returns false. Only the sub classes that differ from this would have to overwrite the method.

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>         Attachments: patch.txt
>
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Paco Avila (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503349 ] 

Paco Avila commented on JCR-967:
--------------------------------

But you can exclude jcr:system from the search query, isn't it? In my application my queries start from my "root node" not from the repository root.

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-967) Only search the index for the "jcr:system" tree if needed

Posted by "Marcel Reutegger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506533 ] 

Marcel Reutegger commented on JCR-967:
--------------------------------------

Oops, just found an issue with the patch.

queryRootNode = XPathQueryBuilder.createQuery("//test/*", JCR_RESOLVER);
assertTrue(queryRootNode.needsSystemTree());

will fail.

> Only search the index for the "jcr:system" tree if needed
> ---------------------------------------------------------
>
>                 Key: JCR-967
>                 URL: https://issues.apache.org/jira/browse/JCR-967
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: query
>    Affects Versions: 1.3
>            Reporter: Christoph Kiehl
>         Attachments: patch.txt
>
>
> Right now every time a query is executed the index of the current workspace as well as the index of the "jcr:system" tree is searched. A lot of queries are not searching in the "jcr:system" tree at all therefore it should be checked if the query contains paths that include "jcr:system". There are two relevant nodes in the query tree to find that out:
> - what's the first location step and does it include the jcr:system tree? I think that's an easy one.
> - does the query contain a jcr:deref node? If there is an intermediate result of a query may dereference into the jcr:system tree. 
> This should notably speed up query execution if you are working extensively with versioning.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.